You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jayoengchoi@jayoengs-MacBook-Pro lib % flutter doctor -v
[✓] Flutter (Channel stable, 3.27.1, on macOS 14.5 23F79 darwin-arm64, locale en-KR)
• Flutter version 3.27.1 on channel stable at /Users/jayoengchoi/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 17025dd882 (6 weeks ago), 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 35.0.0)
• Android SDK at /Users/jayoengchoi/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• 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 17.0.11+0-17.0.11b1207.24-11852314)
[✓] Connected device (4 available)
• Jonghyuck’s iPhone (mobile) • 00008101-000408410A82001E • ios • iOS 17.5.1 21F90
• macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.265
[✓] Network resources
• All expected network resources are available.
• No issues found!
Dart Version
3.6.0
Steps to Reproduce
import'package:dio/dio.dart';
import'package:flutter/material.dart';
voidmain() {
runApp(constMyApp());
}
classMyAppextendsStatelessWidget {
constMyApp({super.key});
@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
title:'Dio Test',
theme:ThemeData(
colorScheme:ColorScheme.fromSeed(seedColor:Colors.deepPurple),
useMaterial3:true,
),
home:constMyHomePage(),
);
}
}
classMyHomePageextendsStatelessWidget {
constMyHomePage({super.key});
@overrideWidgetbuild(BuildContext context) {
returnScaffold(
appBar:AppBar(title:constText('Dio Request Test')),
body:Center(
child:ElevatedButton(
onPressed: _testDioCaching,
child:constText('Test Dio Request Caching'),
),
),
);
}
void_testDioCaching() async {
final dio =Dio();
final cachedRequests =<ListParam, Response>{};
// Define two identical requests with the same ListParamfinal param1 =ListParam(['item1', 'item2'], ListFormat.csv);
final param2 =ListParam(['item1', 'item2'], ListFormat.csv);
// Cache a response for param1final response =await dio.get('https://jsonplaceholder.typicode.com/posts/1');
cachedRequests[param1] = response;
// Check if param2 is considered the same as param1 in the cacheif (cachedRequests.containsKey(param2)) {
debugPrint('Cached response used for param2');
} else {
debugPrint('New request sent for param2');
}
}
}
This example uses the Dio package to simulate an API request and attempts to cache the response.
Two identical ListParam instances (param1 and param2) with the same contents are created.
The param1 request is cached in a map, and the code checks whether the param2 request can retrieve the cached response.
If the two ListParam instances are not treated as equal, the code logs New request sent for param2.
Expected Result
When running the test with two identical ListParam instances (param1 and param2) that have the same contents but different references, the application should correctly identify that these instances are equal. As a result, the cached response for param1 should be used for param2, and the following message should appear in the console:
Cached response used for param2
This confirms that the caching mechanism correctly handles deep equality for ListParam instances with identical contents.
Actual Result
When running the test with two identical ListParam instances (param1 and param2) that have the same contents but different references, the application incorrectly treats these instances as different. As a result, the following message appears multiple times in the console:
New request sent for param2
New request sent for param2
New request sent for param2
This indicates that the caching mechanism is not recognizing ListParam instances with identical contents as equal, leading to repeated requests instead of using the cached response.
The text was updated successfully, but these errors were encountered:
Package
dio
Version
5.7.0
Operating-System
iOS, Web, Android, MacOS, Linux, Windows
Adapter
Default Dio
Output of
flutter doctor -v
Dart Version
3.6.0
Steps to Reproduce
Expected Result
When running the test with two identical ListParam instances (param1 and param2) that have the same contents but different references, the application should correctly identify that these instances are equal. As a result, the cached response for param1 should be used for param2, and the following message should appear in the console:
Cached response used for param2
This confirms that the caching mechanism correctly handles deep equality for ListParam instances with identical contents.
Actual Result
When running the test with two identical ListParam instances (param1 and param2) that have the same contents but different references, the application incorrectly treats these instances as different. As a result, the following message appears multiple times in the console:
This indicates that the caching mechanism is not recognizing ListParam instances with identical contents as equal, leading to repeated requests instead of using the cached response.
The text was updated successfully, but these errors were encountered: