tryCatchK<A, B> function

Option<B> Function(A a) tryCatchK<A, B>(
  1. B f(
    1. A value
    )
)

A variant of tryCatch, that allows for passing in external values.

final catcher = tryCatchK((int i) => i > 5 ? throw 'fail' : i);
expect(catcher(10), some(10));
expect(catcher(3), none());

Implementation

Option<B> Function(A a) tryCatchK<A, B>(B Function(A value) f) =>
    (a) => tryCatch(() => f(a));