forceRebuild method

  1. @protected
Future<void> forceRebuild()

Cause the entire tree to be 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

@protected
Future<void> forceRebuild() {
  final WidgetsBinding binding = WidgetsBinding.instance;
  if (binding.rootElement != null) {
    binding.buildOwner!.reassemble(binding.rootElement!);
    return binding.endOfFrame;
  }
  return Future<void>.value();
}