reassemble method Null safety

void reassemble(
  1. Element root,
  2. DebugReassembleConfig? reassembleConfig
)

Cause the entire subtree rooted at the given Element to be entirely rebuilt. This is used by development tools when the application code has changed and is being hot-reloaded, to cause the widget tree to pick up any changed implementations.

This is expensive and should not be called except during development.

Implementation

void reassemble(Element root, DebugReassembleConfig? reassembleConfig) {
  if (!kReleaseMode) {
    Timeline.startSync('Preparing Hot Reload (widgets)');
  }
  try {
    assert(root._parent == null);
    assert(root.owner == this);
    root._debugReassembleConfig = reassembleConfig;
    root.reassemble();
  } finally {
    if (!kReleaseMode) {
      Timeline.finishSync();
    }
  }
}