toError abstract method

AsyncState<S> toError(
  1. Object error, {
  2. String? message,
  3. StackTrace? stackTrace,
})

Returns a new state representing an error with the given error.

error is the error object or exception. message is an optional error message. stackTrace is an optional stack trace for debugging.

Use this to transition to an error state from any other state.

Implementation

AsyncState<S> toError(
  Object error, {
  String? message,
  StackTrace? stackTrace,
});