runBusyRunner<T> method
Sets the key to busy, runs the runner and then sets it to not busy when completed.
key: by default typeName
, if null, status will be update in default key
rethrows Exception after setting busy to false by key
Implementation
Future<T?> runBusyRunner<T>(
Callback<Future<T?>> runner, {
Object? key,
bool throwException = false,
}) {
var _key = key ?? typeName;
_runner() async {
setDataFor(_key, null);
return runBusyFuture<T>(
runner(),
key: _key,
throwException: throwException,
);
}
setRunnerFor(_key, _runner);
return _runner();
}