interact method

int interact()
inherited

Starts the rendering processs.

Handles not only rendering the interact function from the State but also the lifecycle methods such as init and dispose. Also does the initial rendering.

Implementation

T interact() {
  // Initialize the state
  final state = pipeState(createState());
  state._component = this;
  state.init();
  _initLinesCount = state.context.linesCount;
  state.context.resetLinesCount();

  // Render initially for the first time
  state.render();
  state.context.increaseRenderCount();

  // Start interact and render loop
  final output = state.interact();

  // Clean up once again at last for the first render
  state.context.wipe();

  // Dispose the lines written by `init()`
  state.context.erasePreviousLine(_initLinesCount);
  disposeState(state);

  return output as T;
}