consec<A, R> function

FutureOr<R> consec<A, R>(
  1. FutureOr<A> a,
  2. FutureOr<R> callback(
    1. A a
    ), {
  3. void onError(
    1. Object e
    )?,
})

Maps a synchronous or asynchronous value to a single value.

Implementation

FutureOr<R> consec<A, R>(
  FutureOr<A> a,
  FutureOr<R> Function(A a) callback, {
  void Function(Object e)? onError,
}) {
  return consecList<R>(
    [a],
    (items) => callback(
      items[0] as A,
    ),
  );
}