Skip to content

[Web] image is cached with webHtmlElementStrategy #164405

@GiacomoPignoni

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!

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