catchError method
void
catchError(
- Exception? ex, {
- StackTrace? stack,
- String? library,
- DiagnosticsNode? context,
- IterableFilter<
String> ? stackFilter, - InformationCollector? informationCollector,
- bool? silent,
inherited
Catch and explicitly handle the error.
Implementation
void catchError(
Exception? ex, {
StackTrace? stack,
String? library,
DiagnosticsNode? context,
IterableFilter<String>? stackFilter,
InformationCollector? informationCollector,
bool? silent,
}) {
if (ex == null) {
return;
}
/// If a tester is running. Don't handle the error.
if (WidgetsBinding.instance is WidgetsFlutterBinding) {
//
FlutterError.onError!(FlutterErrorDetails(
exception: ex,
stack: stack,
library: library ?? '',
context: context,
stackFilter: stackFilter,
informationCollector: informationCollector,
silent: silent ?? false,
));
}
}