runApp function Null safety

void runApp(
  1. Widget widgetBuilder(
    1. Map<String, String> args
  2. {@Deprecated('Use [target] instead') String? targetId,
  3. Element? target}

Creates a new app and appends it to the target HTML element. The args contain all attributes of the HTML element.


void runApp(
  Widget Function(Map<String, String> args) widgetBuilder, {
  @Deprecated('Use [target] instead') String? targetId,
  Element? target,
}) {
  targetId ??= 'app';
  target ??= document.getElementById(targetId);
  if (target == null) {
    throw Exception('There is no element with the ID $targetId in the DOM!');
  _appNode = target;
  _appNode.children = [widgetBuilder(_appNode.dataset).wrapWithElement()];