initialize method
Initializes the camera on the device.
You must call dispose when you are done using the camera, otherwise it will remain locked and be unavailable to other applications.
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.
Implementation
Future<void> initialize() {
if (_instance == this) {
return Future<void>.value();
}
final Completer<void> completer = Completer<void>();
if (_instance != null) {
_instance!
.dispose()
.then((_) => configurator.initialize())
.then((_) => completer.complete());
}
_instance = this;
return completer.future;
}