Showing
1 changed file
with
11 additions
and
6 deletions
| @@ -125,10 +125,8 @@ mixin InternalTorchDetection on InternalStreamCreation { | @@ -125,10 +125,8 @@ mixin InternalTorchDetection on InternalStreamCreation { | ||
| 125 | final photoCapabilities = await promiseToFuture<PhotoCapabilities>( | 125 | final photoCapabilities = await promiseToFuture<PhotoCapabilities>( |
| 126 | imageCapture.getPhotoCapabilities(), | 126 | imageCapture.getPhotoCapabilities(), |
| 127 | ); | 127 | ); |
| 128 | - final fillLightMode = photoCapabilities.fillLightMode; | ||
| 129 | - if (fillLightMode != null) { | ||
| 130 | - return fillLightMode; | ||
| 131 | - } | 128 | + |
| 129 | + return photoCapabilities.fillLightMode; | ||
| 132 | } | 130 | } |
| 133 | } catch (e) { | 131 | } catch (e) { |
| 134 | // ImageCapture is not supported by some browsers: | 132 | // ImageCapture is not supported by some browsers: |
| @@ -162,9 +160,16 @@ class Promise<T> {} | @@ -162,9 +160,16 @@ class Promise<T> {} | ||
| 162 | 160 | ||
| 163 | @JS() | 161 | @JS() |
| 164 | @anonymous | 162 | @anonymous |
| 165 | -class PhotoCapabilities { | 163 | +@staticInterop |
| 164 | +class PhotoCapabilities {} | ||
| 165 | + | ||
| 166 | +extension PhotoCapabilitiesExtension on PhotoCapabilities { | ||
| 167 | + @JS('fillLightMode') | ||
| 168 | + external List<dynamic>? get _fillLightMode; | ||
| 169 | + | ||
| 166 | /// Returns an array of available fill light options. Options include auto, off, or flash. | 170 | /// Returns an array of available fill light options. Options include auto, off, or flash. |
| 167 | - external List<String>? get fillLightMode; | 171 | + List<String> get fillLightMode => |
| 172 | + _fillLightMode?.cast<String>() ?? <String>[]; | ||
| 168 | } | 173 | } |
| 169 | 174 | ||
| 170 | @JS('ImageCapture') | 175 | @JS('ImageCapture') |
-
Please register or login to post a comment