before method
This is an optional method that may be overridden to run during action
dispatching, before reduce
. If this method throws an error, the
reduce
method will NOT run, but the method after
will.
It may be synchronous (returning void
) ou async (returning Future<void>
).
You should NOT return FutureOr
.
Implementation
@override
Future<void> before() async {
var result = await checkConnectivity();
if (result == ConnectivityResult.none) throw AbortDispatchException();
}