otherwise method

void otherwise(
  1. void buildOtherwise(
    1. TransitionHandlerBuilder<D, C> builder
    ), {
  2. String? label,
})

Adds a transition behavior that will take place if no other conditions evaluate to true.

The buildOtherwise callback is used to define the behavior that should take place.

Implementation

void otherwise(
  void Function(TransitionHandlerBuilder<D, C> builder) buildOtherwise, {
  String? label,
}) {
  var otherwiseBuilder = _makeBuilder();
  buildOtherwise(otherwiseBuilder);

  var otherwiseDescr = otherwiseBuilder._descriptor;
  if (otherwiseDescr != null) {
    var conditionInfo = TransitionConditionInfo(label, otherwiseDescr.info);
    _conditions.add(
      TransitionConditionDescriptor<C>(
        conditionInfo,
        (_) => (_) => true,
        otherwiseDescr,
      ),
    );
  }
}