createBubble method

Future<void> createBubble(
  1. Step? builder()
)

Implementation

Future<void> createBubble(Step? Function() builder) async {
  depth++;
  final int initialDepth = depth;
  final none = () => null;

  /*
   * The [decide()] function will be the candidate for every [Step] of his
   * builder. Therefore whenever the next Step should be returned, the [Bubble]
   * will decide if it is still open and return the next [decide()] or the actual
   * next "[candidate]" ([Step] in execution order).
   */
  FutureOr<Step?> decide() async {
    final Step? built = builder();
    /*
     * The [depth] of the controller will be able to change from the
     * [Step]s the [Bubble] includes.
     */
    if (initialDepth > depth || built == null) {
      return none();
    }
    return built.execute(this, decide);
  }

  await decide();
}