downloadSingleFile method
Future<String?>
downloadSingleFile({
- required String? url,
- required String fileName,
- required Function response,
- bool? saveToPhoto = false,
- bool? showToastAndroid = false,
override
Implementation
@override
Future<String?> downloadSingleFile({
required String? url,
required String fileName,
required Function response,
bool? saveToPhoto = false,
bool? showToastAndroid = false
}) async {
try {
final result = await downloadSingleFileMethodChannel.invokeMethod<String>(
downloadSingleFileMethod, {'url': url,
'file_name': fileName,
'save_to_photo': saveToPhoto,
'show_toast': showToastAndroid
});
response(result);
return result;
} on PlatformException catch (e) {
debugPrint("PlatformException: ${e.code} - ${e.message}");
response(e);
return "PlatformException: ${e.code} - ${e.message}";
} catch (e) {
response(e);
return "Exception: $e";
}
}