Skip to content

[Web][CanvasKit] Flutter not rendering images when canvasKitForceCpuOnly option is on #175423

Description

@dutsky

Steps to reproduce

  1. Implement simple web app that show images
  2. Add canvasKitForceCpuOnly: true option to flutter_bootstrap.js
  3. Run that app in web

Expected results

Image must appear

Actual results

Image is not shown

Code sample

Code sample
import 'dart:convert';
import 'package:flutter/material.dart';

void main() {
  runApp(const CanvaskitCpuBug());
}

class CanvaskitCpuBug extends StatelessWidget {
  const CanvaskitCpuBug({super.key});

  // Tiny yellow square.
  static const String tinyImage =
      'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Bug Report Example')),
        body: Center(
          child: DecoratedBox(
            decoration: BoxDecoration(border: Border.all(color: Colors.red)),
            child: Image.memory(
              base64Decode(tinyImage),
              width: 100,
              height: 100,
              fit: BoxFit.contain,
            ),
          ),
        ),
      ),
    );
  }
}

web/flutter_bootstrap.js contents:

{{flutter_js}}
{{flutter_build_config}}

const customConfig = {
    'canvasKitForceCpuOnly': true,
};

_flutter.loader.load({
    config: customConfig,
});

Screenshots or Video

Screenshots / Video demonstration

When canvasKitForceCpuOnly: true:
Image

When canvasKitForceCpuOnly: false or flutter_bootstrap.js is missing:
Image

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.37.0-1.0.pre-132, on macOS 13.7.6 22H625
    darwin-arm64, locale en-US) [7.4s]
    • Flutter version 3.37.0-1.0.pre-132 on channel master at
      /Users/user/fvm/versions/master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d4281d1ed8 (11 hours ago), 2025-09-15 23:35:21 -0400
    • Engine revision d4281d1ed8
    • Dart version 3.10.0 (build 3.10.0-206.0.dev)
    • DevTools version 2.50.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop,
      enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets, omit-legacy-version-file, enable-lldb-debugging

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    [9.7s]
    • Android SDK at /Users/user/soft/android-sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-36, build-tools 35.0.0
    • ANDROID_HOME = /Users/user/soft/android-sdk
    • Java binary at: /usr/bin/java
      This JDK was found in the system PATH.
      To manually set the JDK path, use: `flutter config
      --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Homebrew (build 17.0.14+0)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor
      --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 15.2) [10.3s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.16.2

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

[✓] Connected device (2 available) [23.3s]    
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.7.6 22H625
      darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 140.0.7339.133

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

! Doctor found issues in 1 category.

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listc: renderingUI glitches reported at the engine/skia or impeller rendering levele: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine related. See also e: labels.found in release: 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37has 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
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions