post<M> method

void post<M>({
  1. M getValue(
    1. TransitionContext ctx,
    2. D data,
    3. P payload
    )?,
  2. M? value,
  3. String? label,
})

Implementation

void post<M>({
  M Function(TransitionContext ctx, D data, P payload)? getValue,
  M? value,
  String? label,
}) {
  if (getValue == null && value == null) {
    throw ArgumentError('getValue or value must be provided');
  } else if (getValue != null && value != null) {
    throw ArgumentError('One of getValue or value must be provided');
  }
  _handler = _TransitionHandlerDescriptor.post<M>(
    (transCtx) {
      return getValue != null
          ? getValue(transCtx, transCtx.dataValueOrThrow<D>(), transCtx.payloadOrThrow<P>())
          : value!;
    },
    label,
  );
}