runZoneGuardedWithLogging method
Future<void> ?
runZoneGuardedWithLogging(
- FutureCallback onRun, {
- void onError()?,
- Map<
Object?, Object?> ? zoneValues, - ZoneSpecification? zoneSpecification,
This can be used to catch errors in a zone. ometimes, errors are instead caught by Zones. A common case where relying on Flutter to catch errors would not be enough is when an exception happens inside the onPressed handler of a button.
Implementation
Future<void>? runZoneGuardedWithLogging(
FutureCallback onRun, {
void Function(Object, StackTrace)? onError,
Map<Object?, Object?>? zoneValues,
ZoneSpecification? zoneSpecification,
}) {
return runZonedGuarded<Future<void>>(
onRun,
onError ??
(error, stack) {
onRecordError(
error,
stack,
fatal: true,
);
},
zoneValues: zoneValues,
zoneSpecification: zoneSpecification,
);
}