catchTrace method

Future<T> catchTrace(
  1. void onError(
    1. Object? error,
    2. StackTrace trace
    ), {
  2. bool test(
    1. Object error
    )?,
})

Handles errors, and provides the stack trace emitted by this Future.

This is identical to calling:

future.catchError(onError);

... except that the type signature of onError is strengthened. For historic reasons, the original type signature accepts functions that will always throw at runtime or have unexpected behavior.

Implementation

Future<T> catchTrace(
  void Function(Object? error, StackTrace trace) onError, {
  bool Function(Object error)? test,
}) {
  return catchError(onError, test: test);
}