asyncVal<Msg> static method

StreamValuable<ValuableAsyncValue<Msg>, Msg> asyncVal<Msg>(
  1. Valuable<Stream<Msg>> stream
)

Pseudo constructor to map directly a Msg value to an AsyncValue<Msg>

Implementation

static StreamValuable<ValuableAsyncValue<Msg>, Msg> asyncVal<Msg>(
    Valuable<Stream<Msg>> stream) {
  return StreamValuable(
    stream,
    dataValue: (_, data) => ValuableAsyncValue.data(data),
    errorValue: (_, error, stackTrace) =>
        ValuableAsyncValue.error(error, stackTrace),
    doneValue: (_) => ValuableAsyncValue.noData(closed: true),
    initialData: ValuableAsyncValue.noData(),
    evaluateWithContext: false,
  );
}