CameraController class

Controls a device camera.

Use CameraController.availableCameras to get a list of available cameras.

This class is used as a simple interface to control a camera on Android or iOS.

Only one instance of CameraController can be active at a time. If you call initialize on a CameraController while another is active, the old controller will be disposed before initializing the new controller.

Example using CameraController:

final List<CameraDescription> cameras = async CameraController.availableCameras();
final CameraController controller = CameraController(description: cameras[0]);
controller.initialize();
controller.start();

Constructors

CameraController({required CameraDescriptionNew description})
Default constructor.
factory
CameraController.customConfigurator({required CameraDescriptionNew description, required CameraConfigurator configurator})
Constructor for defining your own CameraConfigurator.
factory

Properties

api CameraApi
final
configurator CameraConfigurator
final
description CameraDescriptionNew
final
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
Deallocate all resources and disables further use of the controller.
initialize() Future<void>
Initializes the camera on the device.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start() Future<void>
Begins the flow of data between the inputs and outputs connected to the camera instance.
stop() Future<void>
Stops the flow of data between the inputs and outputs connected to the camera instance.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

availableCameras() Future<List<CameraDescriptionNew>>
Retrieves a list of available cameras for the current device.