rebuild method

  1. @override
void rebuild()
override

Rebuilds the child widget configuration and updates the child element.

Implementation

@override
/// Rebuilds the child widget configuration and updates the child element.
void rebuild() {
  final builtWidget = runZoned(() {
    return (widget as StatelessWidget).build(this);
  }, zoneValues: {#buildContext: this});

  if (childElement != null &&
      childElement!.widget.runtimeType == builtWidget.runtimeType) {
    childElement!.update(builtWidget);
  } else {
    childElement?.unmount();
    childElement = builtWidget.createElement();
    childElement!.mount(this);
  }
}