PluginTestHost constructor

PluginTestHost({
  1. Iterable<PluginRegistry> registries = const <PluginRegistry>[],
  2. String? backend,
  3. SimulationProfile profile = SimulationProfile.deterministic,
})

A host over fresh fakes, with registries beside them, drawing with backend (none by default, as a server's) under profile.

Implementation

factory PluginTestHost({
  Iterable<PluginRegistry> registries = const <PluginRegistry>[],
  String? backend,
  SimulationProfile profile = SimulationProfile.deterministic,
}) {
  final loop = TestLoop();
  final events = TestEvents();
  final components = TestComponents();
  final snapshots = TestSnapshots();
  return PluginTestHost._(
    loop,
    events,
    components,
    snapshots,
    PluginManager(
      loop: loop,
      events: events,
      // The snapshot fake after the test's own: a test that hands the
      // engine's `Snapshots` gets that one from `registry<…>()`.
      registries: <PluginRegistry>[components, ...registries, snapshots],
      backend: backend,
      profile: profile,
    ),
  );
}