HintController constructor

HintController({
  1. HintTargetRegistry? registry,
  2. HintDiagnosticsHandler? diagnostics,
  3. HintOverlayHost overlayHostBuilder(
    1. HintController
    )?,
})

registry defaults to the default singleton (zero-config). diagnostics defaults to DebugPrintDiagnostics, but only in debug builds: in release the diagnostics cost is zero, reasons go to the callback if the user supplies a handler. overlayHostBuilder is a lazy factory for the render mechanics and receives the controller itself (the engine needs the input back-channel: next/skip/finish); null = headless.

Implementation

HintController({
  HintTargetRegistry? registry,
  HintDiagnosticsHandler? diagnostics,
  HintOverlayHost Function(HintController)? overlayHostBuilder,
})  : _registry = registry ?? HintTargetRegistry.defaultInstance,
      _diagnostics =
          diagnostics ?? (kDebugMode ? const DebugPrintDiagnostics() : null),
      _overlayHostBuilder = overlayHostBuilder {
  // A listener, not a slot: other subsystems subscribe the same way, and
  // several controllers on one registry no longer overwrite each other.
  _registry.addListener(_onRegistryChanged);
  _lastKnownIds = _registry.ids;
}