FakeCameraSession class
A CameraSession that never touches a device.
Drives the same state a real session does — recording flag, elapsed timer, facing and flash — so a composer's viewfinder chrome can be exercised in a widget test, including the auto-stop at the cap.
- Implemented types
Constructors
- FakeCameraSession({CameraAccess access = CameraAccess.granted, CapturedImage? photo, CapturedVideo? video})
Properties
- access ↔ CameraAccess
-
What initialize reports. Set to a denial to render a permission state.
getter/setter pair
- facing → CameraFacing
-
no setteroverride
- flash → CameraFlash
-
no setteroverride
- flipCount ↔ int
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- initializeCount ↔ int
-
getter/setter pair
- isDisposed ↔ bool
-
getter/setter pair
- isInitialized → bool
-
no setteroverride
-
isRecording
→ ValueListenable<
bool> -
True while a recording is running. Also the auto-stop signal: the session
clears this on its own when startVideoRecording's cap is reached, and
the host then calls stopVideoRecording to collect the file.
no setteroverride
- lastMaxDuration ↔ Duration?
-
getter/setter pair
- mode → CameraCaptureMode
-
no setteroverride
- photoCount ↔ int
-
getter/setter pair
- preview → PreviewTexture?
-
The texture and geometry to render, or null before initialize completes.
no setteroverride
-
recordedDuration
→ ValueListenable<
Duration> -
How long the running recording has been going, for an on-screen timer.
Resets to zero when recording stops.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
capturePhoto(
) → Future< CapturedImage> -
override
-
cycleFlash(
) → Future< void> -
override
-
dispose(
) → Future< void> -
override
-
flip(
) → Future< void> -
override
-
initialize(
CameraCaptureMode mode) → Future< CameraAccess> -
Opens the device for
mode, claiming the microphone only whenmodeis CameraCaptureMode.video. Safe to call again to switch mode.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pausePreview(
) → Future< void> -
Releases the device when the app backgrounds or an edit step opens;
resumePreview reopens it.
override
-
resumePreview(
) → Future< void> -
override
-
startVideoRecording(
{Duration? maxDuration}) → Future< void> -
Starts recording, auto-stopping at
maxDurationso a capped composer never has to police the length after the fact.override -
stopVideoRecording(
) → Future< CapturedVideo> -
override
-
tick(
Duration elapsed) → void - Advances the on-screen timer without a real clock, and fires the auto-stop once the cap is reached — the same signal the real session sends.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited