FailureObserver typedef

FailureObserver = void Function(Failure failure, Object error, StackTrace stackTrace)

Observability hook: invoked with every failure a handler produces, together with the exception that caused it and its stack trace. Wire your error tracker (Sentry, Crashlytics, ...) here in one line:

NetworkHandler(
  MyErrorRegistry(),
  onFailure: (failure, error, stack) =>
      Sentry.captureException(error, stackTrace: stack),
);

Implementation

typedef FailureObserver = void Function(
    Failure failure, Object error, StackTrace stackTrace);