runBusyFuture<T> method
Sets the Controller to busy, runs the future and then sets it to not busy when complete.
rethrows Exception after setting busy to false for object or class
Implementation
@override
Future<T?> runBusyFuture<T>(
Future<T?> future, {
Object? key,
bool throwException = false,
}) async {
clearErrors();
final _key = key ?? typeName;
setBusyFor(_key, true);
try {
var value = await runErrorFuture(
future,
key: key,
throwException: throwException,
);
setDataFor(_key, value);
setBusyFor(_key, false);
return value;
} catch (e) {
setBusyFor(_key, false);
if (throwException) rethrow;
return Future.value();
}
}