catchFuture<T> method
Implementation
Future<T> catchFuture<T>(Future<T> Function() task, {
bool catchError = true,
}) async {
try {
addTask();
final result = await task();
return result;
} catch (error, stacktrace) {
if (catchError) {
_errors.add(error);
}
if (kDebugMode) {
stacktrace.printError();
}
throw error;
} finally {
completeTask();
}
}