runApp method

void runApp(
  1. Widget app
)

Mount app as this binding's root widget and schedule the first frame.

Implementation

void runApp(Widget app) {
  if (_disposed || _disposing) {
    throw StateError('Cannot mount a widget after TuiBinding.dispose().');
  }
  if (_root != null) {
    throw StateError('TuiBinding already has a mounted root widget.');
  }

  try {
    final root = app.createElement();
    _root = root;
    root.mount(null, _owner);
    _owner.finalizeTree();
    WidgetInspectorService.instance.registerRoot(root);
    _scheduler.scheduleFrame();
  } on Object catch (error, stackTrace) {
    try {
      dispose();
    } on Object {
      // The mount failure remains primary after rollback is attempted.
    }
    Error.throwWithStackTrace(error, stackTrace);
  }
}