fromChannelAndAncestor<D, DAncestor, P> static method

InitialData<D> fromChannelAndAncestor<D, DAncestor, P>(
  1. Channel<P> channel,
  2. D initialValue(
    1. DAncestor parentData,
    2. P payload
    )
)

Creates an InitialData that produces its initial value by calling initialValue with a value of type DAncestor, obtained by from an ancestor state in the state tree, and the payload value of channel.

Implementation

static InitialData<D> fromChannelAndAncestor<D, DAncestor, P>(
  Channel<P> channel,
  D Function(DAncestor parentData, P payload) initialValue,
) {
  return InitialData._(
    (ctx) => initialValue(ctx.dataValueOrThrow<DAncestor>(), ctx.payloadOrThrow<P>()),
  );
}