handleAsync<T> method

Future<T> handleAsync<T>(
  1. Future<T> operation()
)

Implementation

Future<T> handleAsync<T>(Future<T> Function() operation) async {
  try {
    hasError = false;
    update();
    return await operation();
  } catch (e) {
    error = e;
    hasError = true;
    update();
    rethrow;
  } finally {
    update();
  }
}