map<R> method

  1. @override
R? map<R>({
  1. R loading()?,
  2. R success(
    1. T
    )?,
  3. R error(
    1. Object?,
    2. StackTrace?
    )?,
})
override

Maps the current async state to a value with optional handlers.

The loading, success, and error callbacks handle the corresponding state variants. Returns null when the callback for this state's variant is omitted.

Implementation

@pragma("vm:prefer-inline")
@pragma("wasm:prefer-inline")
@pragma("dart2js:prefer-inline")
@override
R? map<R>({
  R Function()? loading,
  R Function(T)? success,
  R Function(Object?, StackTrace?)? error,
}) =>
    value.map(
      loading: loading,
      success: success,
      error: error,
    );