getThumbnail static method

Future<List<int>> getThumbnail({
  1. required String mediumId,
  2. MediumType? mediumType,
  3. int? width,
  4. int? height,
  5. bool? highQuality = false,
})

Get medium thumbnail by medium id mediumId: the identifier of medium width: the width of medium height: the height of medium heightQuality: whether to use high quality of medium thumbnail

Implementation

static Future<List<int>> getThumbnail({
  required String mediumId,
  MediumType? mediumType,
  int? width,
  int? height,
  bool? highQuality = false,
}) async {
  final bytes = await _channel.invokeMethod('getThumbnail', {
    'mediumId': mediumId,
    'mediumType': mediumTypeToJson(mediumType),
    'width': width,
    'height': height,
    'highQuality': highQuality,
  });
  if (bytes == null) throw "Failed to fetch thumbnail of medium $mediumId";
  return List<int>.from(bytes);
}