onReceivedRequestError method
void
onReceivedRequestError(
- WebView webView,
- WebResourceRequest request,
- WebResourceError error
Report web resource loading error to the host application.
These errors usually indicate inability to connect to the server. Note that unlike the deprecated version of the callback, the new version will be called for any resource (iframe, image, etc.), not just for the main page. Thus, it is recommended to perform minimum required work in this callback.
Implementation
@override
void onReceivedRequestError(
android_webview.WebView webView,
android_webview.WebResourceRequest request,
android_webview.WebResourceError error,
) {
if (request.isForMainFrame) {
onWebResourceErrorCallback(WebResourceError(
errorCode: error.errorCode,
description: error.description,
failingUrl: request.url,
errorType: _errorCodeToErrorType(error.errorCode),
));
}
}