Errors class final
Global facade for capturing errors and managing zone-local error scopes.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- currentScope → ErrorScope
-
Zone-local scope, configured root scope, or an in-memory fallback scope.
no setter
- manager → ErrorManager?
-
Currently configured manager, or
nullwhen reporting is disabled.no setter
Static Methods
-
addBreadcrumb(
ErrorBreadcrumb breadcrumb) → void -
Adds
breadcrumbto the current zone-local scope. -
captureException(
Object exception, {StackTrace? stackTrace, ErrorSeverity severity = ErrorSeverity.error, bool fatal = false, bool handled = true, ErrorMechanism mechanism = ErrorMechanism.manual, String? reason, Map< String, Object?> attributes = const {}, Map<String, String> tags = const {}, Map<String, Map< contexts = const {}, List<String, Object?> >String> ? fingerprint, List<ErrorAttachment> attachments = const [], ErrorUser? user}) → Future<ErrorId?> -
Captures
exception, returning its ID when processors accept the report. -
configure(
ErrorManager manager) → void -
Installs
managerwithout shutting down a previously configured manager. -
disable(
) → void - Detaches the current manager without flushing or shutting it down.
-
guard<
T> (FutureOr< T> callback(), {bool fatal = true, bool handled = false, ErrorMechanism mechanism = ErrorMechanism.zone}) → Future<T> -
Runs
callback, captures any error, then rethrows it with its stack trace. -
listenToIsolateErrors(
) → ErrorIsolateListener - Registers an error listener for the current isolate.
-
runGuarded<
R> (R callback(), {bool fatal = true, bool rethrowError = false, void onError(Object error, StackTrace stackTrace)?}) → R? -
Runs
callbackin a guarded zone that captures uncaught async errors. -
withScope<
R> (R callback(), {ErrorUser? user, Map< String, String> tags = const {}, Map<String, Map< contexts = const {}, List<String, Object?> >String> ? fingerprint, List<ErrorAttachment> attachments = const []}) → R -
Runs
callbackin a child scope containing the supplied context.