onBuild method Null safety

void onBuild(
  1. BuildContext context
)

Implementation

void onBuild(BuildContext context) {
  bool? current = ModalRoute.of(context)?.isCurrent;
  current ??= false;

  this.isCurrent = current;
  globals.elementInstances[this.widget.hashCode] =
      globals.Elem(name: this.name, id: this.id, widget: this);
}