MockVisionBackend constructor

MockVisionBackend({
  1. bool supported = true,
  2. TrackingData? stillResult,
  3. CameraController? cameraController,
})

Creates a mock backend.

Set supported false to exercise the backendUnavailable path. stillResult is what detectStill resolves to (photo-mode tests). cameraController, if given, is returned once start has been called (mirroring a real backend, whose controller only exists after start) — useful for testing that VirtualTryOn wires a camera preview in once one is available. It's never initialized by this mock; construct it uninitialized (real camera hardware is never touched) if your test needs one.

Implementation

MockVisionBackend({
  bool supported = true,
  this.stillResult,
  CameraController? cameraController,
})  : _supported = supported,
      _cameraController = cameraController;