Closed as not planned
Description
Steps to reproduce
In the latest Flutter version, in release mode on my phone, using the default engine (which should now be Impeller, but the same issue occurs with Skia), loading images from the cache directory results in display errors. Below is the minimal reproduction and Flutter doctor information, as well as my phone details:
{
"version": {
"baseOS": "",
"securityPatch": "2024-11-01",
"sdkInt": 35,
"release": 15,
"codename": "REL",
"previewSdkInt": 0,
"incremental": "OS2.0.11.0.VOMCNXM"
},
"supportedAbis": [
"arm64-v8a"
],
"supported32BitAbis": [],
"display": "AQ3A.240829.*",
"type": "user",
"isPhysicalDevice": true,
"isLowRamDevice": false
}
The phone model is Redmi K80 Pro, and the processor is Snapdragon 8 Elite.
If there is any information that needs to be supplemented, please let me know. I'd be happy to help debug.
Expected results
Theoretically, it should perform very well.
Actual results
But in reality, it will show strange display effects, as shown below.
Code sample
Code sample
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:path_provider/path_provider.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Download and Display Image')),
body: Center(
child: FutureBuilder<String>(
future: downloadImage(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
return Image.file(
File(snapshot.data!),
);
}
},
),
),
),
);
}
Future<String> downloadImage() async {
var headers = {
'User-Agent': '#',
'Accept': '*/*',
'Host': 'img.picacomic.com',
'Connection': 'keep-alive'
};
var request = http.Request(
'GET',
Uri.parse(
'https://img.picacomic.com/lMjaaAbePhYLfoNtAd6nAi6udOEqwAIEwS1eTBKp5O0/rs:fill:300:400:0/g:sm/aHR0cHM6Ly9zdG9yYWdlLWIucGljYWNvbWljLmNvbS9zdGF0aWMvODM5ZWI2NzktMTdlZC00MjUwLTliOTktMGRmMTI0OTkzNDYyLmpwZw.jpg'));
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
final directory = await getTemporaryDirectory();
final filePath = '${directory.path}/downloaded_image.png';
final file = File(filePath);
await file.writeAsBytes(await response.stream.toBytes());
return filePath;
} else {
throw Exception('Failed to download image: ${response.reasonPhrase}');
}
}
}
Screenshots or Video
Logs
No response
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.27.1, on Microsoft Windows [版本 10.0.26100.2605], locale zh-CN)
• Flutter version 3.27.1 on channel stable at C:\Users\windy\sdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 17025dd882 (21 hours ago), 2024-12-17 03:23:09 +0900
• Engine revision cb4b5fff73
• Dart version 3.6.0
• DevTools version 2.40.2
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:\Users\windy\AppData\Local\Android\Sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = C:\Users\windy\AppData\Local\Android\Sdk
• Java binary at: C:\Users\windy\AppData\Local\Programs\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.12.35527.113
• Windows 10 SDK version 10.0.22621.0
[✓] Android Studio (version 2024.2)
• Android Studio at C:\Users\windy\AppData\Local\Programs\Android Studio
• 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+-12282718-b509.11)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.2)
• IntelliJ at C:\Users\windy\AppData\Local\Programs\IntelliJ IDEA Ultimate 2
• Flutter plugin version 83.0.3
• Dart plugin version 242.24931
[✓] IntelliJ IDEA Ultimate Edition (version 2024.3)
• IntelliJ at C:\Users\windy\AppData\Local\Programs\IntelliJ IDEA Ultimate
• Flutter plugin version 83.0.4
• Dart plugin version 243.23177
[✓] VS Code (version 1.96.0)
• VS Code at C:\Users\windy\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.102.0
[✓] VS Code (version 1.97.0-insider)
• VS Code at C:\Users\windy\AppData\Local\Programs\Microsoft VS Code Insiders
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (5 available)
• 24122RKC7C (mobile) • 1f883fc3 • android-arm64 • Android 15 (API 35)
• 2206122SC (mobile) • 192.168.50.53:5555 • android-x64 • Android 12 (API 32)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.26100.2605]
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.140
• Edge (web) • edge • web-javascript • Microsoft Edge 129.0.2792.65
[✓] Network resources
• All expected network resources are available.
• No issues found!