@@ -219,16 +219,22 @@ html.CanvasElement? tryCreateCanvasElement(int width, int height) {
219219@JS ('window.ImageDecoder' )
220220external Object ? get _imageDecoderConstructor;
221221
222- /// Hides `image_web_codecs.dart` behind a flag.
223- // TODO(yjbanov): https://github.com/flutter/flutter/issues/95277
224- const bool _imageDecoderExperimentEnabled = bool .fromEnvironment (
225- 'EXPERIMENTAL_IMAGE_DECODER' ,
226- defaultValue: false ,
222+ /// Environment variable that allows the developer to opt out of using browser's
223+ /// `ImageDecoder` API, and use the WASM codecs bundled with CanvasKit.
224+ ///
225+ /// While all reported severe issues with `ImageDecoder` have been fixed, this
226+ /// API remains relatively new. This option will allow developers to opt out of
227+ /// it, if they hit a severe bug that we did not anticipate.
228+ // TODO(yjbanov): remove this flag once we're fully confident in the new API.
229+ // https://github.com/flutter/flutter/issues/95277
230+ const bool _browserImageDecodingEnabled = bool .fromEnvironment (
231+ 'BROWSER_IMAGE_DECODING_ENABLED' ,
232+ defaultValue: true ,
227233);
228234
229235/// Whether the current browser supports `ImageDecoder` .
230236bool browserSupportsImageDecoder =
231- _imageDecoderExperimentEnabled &&
237+ _browserImageDecodingEnabled &&
232238 _imageDecoderConstructor != null &&
233239 browserEngine == BrowserEngine .blink;
234240
0 commit comments