Skip to content

[Web] image is cached with webHtmlElementStrategy #164405

Closed

Description

@GiacomoPignoni

Steps to reproduce

Create an Image.newtork with WebHtmlElementStrategy.prefer
Add another Image.newtork, with same url as the image before, but with WebHtmlElementStrategy.never

Expected results

The second image should not use the HTML element

Actual results

The second image use the HTML element

Code sample

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text('HTML'),
            SizedBox(
              width: 200,
              height: 100,
              child: Image.network(
                'https://docs.flutter.dev/cookbook/img-files/effects/parallax/01-mount-rushmore.jpg',
                webHtmlElementStrategy: WebHtmlElementStrategy.prefer,
              ),
            ),
            const SizedBox(height: 100),
            Text('NOT HTML'),
            const SizedBox(height: 50),
            SizedBox(
              width: 200,
              height: 100,
              child: Image.network(
                'https://docs.flutter.dev/cookbook/img-files/effects/parallax/01-mount-rushmore.jpg',
                webHtmlElementStrategy: WebHtmlElementStrategy.never,
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

Image

Logs

No response

Flutter Doctor output

Doctor output
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine 29a2f674ca2312e34a3ef796701c297dc3be1ae6...
Expanding downloaded archive with PowerShell...
Building flutter tool...
Running pub upgrade...
Resolving dependencies... (1.1s)
Downloading packages...
Got dependencies.
Downloading package sky_engine...                                  979ms
Downloading package flutter_gpu...                                 204ms
Downloading flutter_patched_sdk tools...                           918ms
Downloading flutter_patched_sdk_product tools...                   905ms
Downloading windows-x64 tools...                                    4,1s
Downloading windows-x64/font-subset tools...                       945ms
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 3.30.0-0.1.pre, on Microsoft Windows [Versione 10.0.26100.3194], locale it-IT)
[✓] Windows Version (11 Home 64-bit, 24H2, 2009)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.11.7)
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2023.2)
[✓] VS Code (version 1.97.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Mar 3, 2025
  2. huycozy commented on Mar 3, 2025

    @huycozy
    Member

    Thanks for the report, @GiacomoPignoni
    Reproduced on Flutter master 3.30.0-1.0.pre.426 as well.
    Image

    Flutter version
    [!] Flutter (Channel master, 3.30.0-1.0.pre.426, on macOS 15.3.1 24D70 darwin-x64, locale en-VN) [2.3s]
        • Flutter version 3.30.0-1.0.pre.426 on channel master at /Users/huynq/Documents/GitHub/flutter_master
        ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 842db35d27 (13 hours ago), 2025-03-02 09:30:28 -0500
        • Engine revision 842db35d27
        • Dart version 3.8.0 (build 3.8.0-133.0.dev)
        • DevTools version 2.43.0
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
  3. added
    platform-webWeb applications specifically
    a: imagesLoading, displaying, rendering images
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-webOwned by Web platform team
    and removed
    in triagePresently being triaged by the triage team
    on Mar 3, 2025
  4. added
    P2Important issues not at the top of the work list
    triaged-webTriaged by Web platform team
    on Mar 12, 2025
  5. harryterkelsen commented on Jul 10, 2025

    @harryterkelsen
    Contributor

    While working on a fix for a separate issue I also fixed this issue. See #171916

  6. added
    P1High-priority issues at the top of the work list
    and removed
    P2Important issues not at the top of the work list
    on Jul 16, 2025
  7. github-actions commented on Jul 30, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: imagesLoading, displaying, rendering imagesfound in release: 3.29Found to occur in 3.29found in release: 3.30Found to occur in 3.30has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyteam-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