downloadMedia method
- String eventId,
- ThumbnailSize? thumbSize,
- String dirPath
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(
String eventId,
ThumbnailSize? thumbSize,
String dirPath,
) {
final tmp1 = eventId;
final tmp5 = thumbSize;
final tmp9 = dirPath;
var tmp0 = 0;
var tmp2 = 0;
var tmp3 = 0;
var tmp4 = 0;
var tmp6 = 0;
var tmp8 = 0;
var tmp10 = 0;
var tmp11 = 0;
var tmp12 = 0;
tmp0 = _box.borrow();
final tmp1_0 = utf8.encode(tmp1);
tmp3 = tmp1_0.length;
final ffi.Pointer<ffi.Uint8> tmp2_0 = _api.__allocate(tmp3 * 1, 1);
final Uint8List tmp2_1 = tmp2_0.asTypedList(tmp3);
tmp2_1.setAll(0, tmp1_0);
tmp2 = tmp2_0.address;
tmp4 = tmp3;
if (tmp5 == null) {
tmp6 = 0;
} else {
tmp6 = 1;
final tmp7 = tmp5;
tmp8 = tmp7._box.move();
}
final tmp9_0 = utf8.encode(tmp9);
tmp11 = tmp9_0.length;
final ffi.Pointer<ffi.Uint8> tmp10_0 = _api.__allocate(tmp11 * 1, 1);
final Uint8List tmp10_1 = tmp10_0.asTypedList(tmp11);
tmp10_1.setAll(0, tmp9_0);
tmp10 = tmp10_0.address;
tmp12 = tmp11;
final tmp13 = _api._convoDownloadMedia(
tmp0,
tmp2,
tmp3,
tmp4,
tmp6,
tmp8,
tmp10,
tmp11,
tmp12,
);
final tmp15 = tmp13;
final ffi.Pointer<ffi.Void> tmp15_0 = ffi.Pointer.fromAddress(tmp15);
final tmp15_1 = _Box(_api, tmp15_0, "__Convo_download_media_future_drop");
tmp15_1._finalizer = _api._registerFinalizer(tmp15_1);
final tmp14 = _nativeFuture(tmp15_1, _api.__convoDownloadMediaFuturePoll);
return tmp14;
}