InputMediaPhoto.fromFile constructor

InputMediaPhoto.fromFile({
  1. required File media,
  2. String? caption,
  3. String? parseMode,
  4. List<MessageEntity>? captionEntities,
  5. bool? hasSpoiler,
})

Implementation

factory InputMediaPhoto.fromFile(
        {required io.File media,
        String? caption,
        String? parseMode,
        List<MessageEntity>? captionEntities,
        bool? hasSpoiler}) =>
    InputMediaPhoto(
      media: 'attach://${media.path}',
      caption: caption,
      parseMode: parseMode,
      captionEntities: captionEntities,
      hasSpoiler: hasSpoiler,
    )..mediaFile = MultipartFile(
        media.path, media.openRead(), media.lengthSync(),
        filename: media.path.split('/').last);