supportedFlashModes method

  1. @override
Future<List<FlashMode>> supportedFlashModes()
override

The supported FlashModes for the attached camera device.

This should only be called after passing as a parameter to a CameraController and CameraController.initialize has been called.

Implementation

@override
Future<List<FlashMode>> supportedFlashModes() async {
  verifyAttached();
  final List<String> flashModes =
      await _controller.cameraParameters.getSupportedFlashModes();

  final List<FlashMode> supportedModes = <FlashMode>[];
  for (String mode in flashModes) {
    switch (mode) {
      case CameraParameters.flashModeAuto:
        supportedModes.add(FlashMode.auto);
        break;
      case CameraParameters.flashModeOff:
        supportedModes.add(FlashMode.off);
        break;
      case CameraParameters.flashModeOn:
        supportedModes.add(FlashMode.on);
        break;
    }
  }
  return supportedModes;
}