notify static method

void notify(
  1. Failure failure, [
  2. StackTrace? stackTrace
])

Silently dispatches the failure to the registered observer, if any.

This should be called directly from the constructor of your core Failure class, or when a FailureResult is instantiated.

Implementation

static void notify(Failure failure, [StackTrace? stackTrace]) {
  try {
    _delegate?.call(failure, stackTrace);
  } catch (_) {
    // Prevents the observer itself from crashing the main application flow
    // if the telemetry service (like Firebase) throws an exception.
  }
}