downloadMedia method

Future<OptionString> downloadMedia(
  1. ThumbnailSize? thumbSize,
  2. String dirPath
)

if this is a media, hand over the data if thumb size is given, media thumbnail is returned download media (image/audio/video/file/location) to specified path if thumb size is given, media thumbnail is returned if thumb size is not given, media file is returned

Implementation

Future<OptionString> downloadMedia(
  ThumbnailSize? thumbSize,
  String dirPath,
) {
  final tmp1 = thumbSize;
  final tmp5 = dirPath;
  var tmp0 = 0;
  var tmp2 = 0;
  var tmp4 = 0;
  var tmp6 = 0;
  var tmp7 = 0;
  var tmp8 = 0;
  tmp0 = _box.borrow();
  if (tmp1 == null) {
    tmp2 = 0;
  } else {
    tmp2 = 1;
    final tmp3 = tmp1;
    tmp4 = tmp3._box.move();
  }
  final tmp5_0 = utf8.encode(tmp5);
  tmp7 = tmp5_0.length;

  final ffi.Pointer<ffi.Uint8> tmp6_0 = _api.__allocate(tmp7 * 1, 1);
  final Uint8List tmp6_1 = tmp6_0.asTypedList(tmp7);
  tmp6_1.setAll(0, tmp5_0);
  tmp6 = tmp6_0.address;
  tmp8 = tmp7;
  final tmp9 = _api._attachmentDownloadMedia(
    tmp0,
    tmp2,
    tmp4,
    tmp6,
    tmp7,
    tmp8,
  );
  final tmp11 = tmp9;
  final ffi.Pointer<ffi.Void> tmp11_0 = ffi.Pointer.fromAddress(tmp11);
  final tmp11_1 =
      _Box(_api, tmp11_0, "__Attachment_download_media_future_drop");
  tmp11_1._finalizer = _api._registerFinalizer(tmp11_1);
  final tmp10 =
      _nativeFuture(tmp11_1, _api.__attachmentDownloadMediaFuturePoll);
  return tmp10;
}