isFailed static method

bool isFailed(
  1. BuildContext context,
  2. Object actionOrTypeOrList, {
  3. bool notify = true,
})

Returns true if an actionOrTypeOrList failed with an UserException.

It's recommended that you use the BuildContext extension instead:

if (context.isFailed(MyAction)) { // Show an error message. }

Widgets that use this method WILL rebuild whenever the state changes (unless you pass the notify parameter as false).

Implementation

static bool isFailed(
  BuildContext context,
  Object actionOrTypeOrList, {
  bool notify = true,
}) =>
    (notify ? _getStoreWithDependency_Untyped : _getStoreNoDependency_Untyped)(context)
        .isFailed(actionOrTypeOrList);