onDownloadStart method
void
onDownloadStart()
Notify the host application that a file should be downloaded.
Implementation
@override
void onDownloadStart(
String url,
String userAgent,
String contentDisposition,
String mimetype,
int contentLength,
) {
if (_onNavigationRequest == null) {
return;
}
final FutureOr<bool> returnValue = _onNavigationRequest!(
url: url,
isForMainFrame: true,
);
if (returnValue is bool && returnValue) {
loadUrl(url, <String, String>{});
} else {
(returnValue as Future<bool>).then((bool shouldLoadUrl) {
if (shouldLoadUrl) {
loadUrl(url, <String, String>{});
}
});
}
}