start method

Future<CameraController> start({
  1. bool reuse = true,
})

Implementation

Future<CameraController> start({bool reuse = true}) async {
  // Vorhandenen Controller wiederverwenden, wenn möglich
  if (reuse && _controller != null && _controller!.value.isInitialized) {
    return _controller!;
  }

  // Neuen Controller erstellen
  _controller = await newController;
  if (_controller == null) {
    throw Exception("Kamerainitialisierung fehlgeschlagen");
  }

  // Controller initialisieren und Blitzmodus setzen
  await _controller!.initialize();
  await _setFlashMode(_flashMode);
  await _getZoomRange();

  // Bildschirm hell halten während die Kamera aktiv ist
  await SystemChrome.setEnabledSystemUIMode(
    SystemUiMode.manual,
    overlays: [SystemUiOverlay.bottom],
  );

  return _controller!;
}