loadThumbnail method

Future<ServerThumbnail?> loadThumbnail()

Implementation

Future<ServerThumbnail?> loadThumbnail() async {
  final file = thumbnailFile;
  if (file == null || !await file.exists()) return null;
  final contentType = _thumbnailContentType(file.path);
  if (contentType == null) return null;
  final length = await file.length();
  if (length > kMaxThumbnailSize) return null;
  return ServerThumbnail(
    bytes: await file.readAsBytes(),
    contentType: contentType,
  );
}