flatMapFirst<A> function
Runs the returned Task, but resolves to the result of the previous task. I.e. discards the result.
expect(
await fromThunk(() => 'hi')
.chain(flatMapFirst((s) => fromThunk(() => s.toUpperCase())))(),
equals('hi'),
);
Implementation
Task<A> Function(Task<A> task) flatMapFirst<A>(
Task<dynamic> Function(A value) f,
) =>
(t) => Task(() => t().flatMap((v) => f(v)().flatMap((_) => v)));