InputMediaDocument.withThumbnailFile constructor

InputMediaDocument.withThumbnailFile({
  1. required String media,
  2. required File thumbnail,
  3. String? caption,
  4. String? parseMode,
  5. List<MessageEntity>? captionEntities,
  6. bool? disableContentTypeDetection,
})

Implementation

factory InputMediaDocument.withThumbnailFile({
  required String media,
  required io.File thumbnail,
  String? caption,
  String? parseMode,
  List<MessageEntity>? captionEntities,
  bool? disableContentTypeDetection,
}) =>
    InputMediaDocument(
      type: InputMedia.typeDocument,
      media: media,
      thumbnail: 'attach://${thumbnail.path}',
      caption: caption,
      parseMode: parseMode,
      captionEntities: captionEntities,
      disableContentTypeDetection: disableContentTypeDetection,
    )..thumbnailFile = MultipartFile(
        thumbnail.path, thumbnail.openRead(), thumbnail.lengthSync(),
        filename: thumbnail.path.split('/').last);