Skip to content

GIFs not rendering on Web #161376

@matteoberla

Description

@matteoberla

Steps to reproduce

setup pubspec.yaml with the asset path
try to display a gif on WEB

Notice that:
iOS, android are working fine, on web it was working too before updating to 3.27.1

Image.asset(
  'assets/quickalert/confirm.gif',
  fit: BoxFit.contain,
),

Expected results

As it was before updating and on iOS/android the image was showing with no problem

Actual results

Error:

Error logs
======== Exception caught by image resource service ================================================
The following assertion was thrown resolving an image codec:
Assertion failed: org-dartlang-sdk:///lib/_engine/engine/image_format_detector.dart:407:12
bytes.getUint8(_position) == 0x2c
is not true

When the exception was thrown, this was the stack: 
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:3  throw_
dart-sdk/lib/_internal/js_dev_runtime/private/profile.dart 110:39            assertFailed
dart-sdk/lib/_internal/js_dev_runtime/private/profile.dart 110:39            [_skipGraphicBlock]
lib/_engine/engine/image_format_detector.dart 334:7                          isAnimated
lib/_engine/engine/image_format_detector.dart 47:32                          detectImageType
lib/_engine/engine/canvaskit/image.dart 620:32                               tryDetectImageType
lib/_engine/engine/canvaskit/image.dart 14:31                                <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 610:19          <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 634:23          <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 532:3           _asyncStartSync
lib/_engine/engine/canvaskit/image.dart 9:18                                 skiaInstantiateImageCodec
lib/_engine/engine/canvaskit/renderer.dart 219:7                             <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 610:19          <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 634:23          <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 532:3           _asyncStartSync
lib/_engine/engine/canvaskit/renderer.dart 215:20                            instantiateImageCodec
lib/ui/painting.dart 687:28                                                  <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 610:19          <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 634:23          <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 532:3           _asyncStartSync
lib/ui/painting.dart 682:15                                                  instantiateImageCodecWithSize
packages/flutter/src/painting/binding.dart 147:15                            instantiateImageCodecWithSize
packages/flutter/src/painting/image_provider.dart 765:18                     <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 610:19          <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 634:23          <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 581:31          <fn>
dart-sdk/lib/async/zone.dart 1422:47                                         _rootRunUnary
dart-sdk/lib/async/zone.dart 1324:19                                         runUnary
dart-sdk/lib/async/future_impl.dart 204:18                                   handleValue
dart-sdk/lib/async/future_impl.dart 902:44                                   handleValueCallback
dart-sdk/lib/async/future_impl.dart 931:13                                   _propagateToListeners
dart-sdk/lib/async/future_impl.dart 707:5                                    [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 777:7                                    <fn>
dart-sdk/lib/async/zone.dart 1414:13                                         _rootRun
dart-sdk/lib/async/zone.dart 1317:19                                         run
dart-sdk/lib/async/zone.dart 1225:7                                          runGuarded
dart-sdk/lib/async/zone.dart 1265:23                                         callback
dart-sdk/lib/async/schedule_microtask.dart 40:11                             _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5                              _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 186:7           <fn>
Image provider: AssetImage(bundle: null, name: "assets/quickalert/confirm.gif")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#2699e(), name: "assets/quickalert/confirm.gif", scale: 1)
====================================================================================================

Code sample

Code sample
//not working -> gif
Image.asset(
  'assets/quickalert/confirm.gif',
  fit: BoxFit.contain,
),
//working -> png
Image.asset(
  'assets/quickalert/confirm.png',
  fit: BoxFit.contain,
),

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.27.1, on macOS 15.2 24C101 darwin-arm64, locale it-IT)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.96.2)
[✓] Connected device (3 available)
    ! Error: Browsing on the local area network for Berla. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!
sasoftware@Mac-mini-di-SA SA_PalladioApp % flutter doctor -v
[✓] Flutter (Channel stable, 3.27.1, on macOS 15.2 24C101 darwin-arm64, locale it-IT)
    • Flutter version 3.27.1 on channel stable at /Users/sasoftware/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (3 settimane fa), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/sasoftware/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Users/sasoftware/Library/Java/JavaVirtualMachines/jbr-17.0.12/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment JBR-17.0.12+1-1207.37-nomod (build 17.0.12+1-b1207.37)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] VS Code (version 1.96.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 15.2 24C101 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 15.2 24C101 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 131.0.6778.206
    ! Error: Browsing on the local area network for Berla. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: assetsPackaging, accessing, or using assetsc: renderingUI glitches reported at the engine/skia or impeller rendering levelengineflutter/engine related. See also e: labels.found in release: 3.27Found to occur in 3.27found in release: 3.28Found to occur in 3.28has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions