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<int> flashModes = await capturePhotoOutput.supportedFlashModes();

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