dartz icon indicating copy to clipboard operation
dartz copied to clipboard

Add catchAsync for Either

Open otto-dev opened this issue 3 years ago • 0 comments

Like catching, but for async function bodies.

Usage:

  Future<Either<dynamic, FooBar>> doAsyncThings() {
    return catchAsync(() async {
      final foo = await asyncAction();
      final bar = await asyncAction();
      return foo + bar;
    });
  }

otto-dev avatar Apr 15 '22 21:04 otto-dev