initFlashModesForCameras method

void initFlashModesForCameras()

Initializes the flash modes in validFlashModes for each CameraDescription. 为每个 CameraDescriptionvalidFlashModes 中初始化闪光灯模式。

Implementation

void initFlashModesForCameras() {
  for (final CameraDescription camera in cameras) {
    if (!validFlashModes.containsKey(camera)) {
      // Mind the order of this list as it has an impact on the switch cycle.
      // Do not use FlashMode.values.
      validFlashModes[camera] = <FlashMode>[
        FlashMode.auto,
        FlashMode.always,
        FlashMode.torch,
        FlashMode.off,
      ];
    }
  }
}