handleLoadingPageError method
Future
handleLoadingPageError(
- WebResourceError error
)
Implementation
Future<dynamic> handleLoadingPageError(WebResourceError error) async {
FlourishLog.severe(
'WebView Load Error - code: ${error.errorCode}, '
'type: ${error.errorType}, '
'description: ${error.description}, '
'isForMainFrame: ${error.isForMainFrame}',
);
if (error.errorCode == 403) {
return _replaceWithErrorPage(FlourishTokenErrorPage(flourish: flourish));
}
if (error.errorType == WebResourceErrorType.connect ||
error.errorType == WebResourceErrorType.timeout ||
error.errorType == WebResourceErrorType.hostLookup ||
error.errorCode == -1009) {
FlourishLog.warning(
'Network connectivity error detected - invoking error handler',
);
final onWebViewLoadError = flourish.onWebViewLoadError;
if (onWebViewLoadError != null) return onWebViewLoadError(context, error);
return _replaceWithErrorPage(WebViewLoadErrorPage(flourish: flourish));
}
}