fromNullableK<A, B> function
Returns an function that transforms a value and can return a nullable result.
If the result is null
, then None is returned. Otherwise it is wrapped in
Some.
final transform = fromNullableK((int i) => i > 5 ? i : null);
expect(transform(10), some(10));
expect(transform(3), none());
Implementation
Option<B> Function(A value) fromNullableK<A, B>(
B? Function(A value) f,
) =>
(a) => fromNullable(f(a));