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
[✓] Flutter (Channel stable, 3.19.2, on macOS 14.0 23A344 darwin-arm64, locale en-VN)
• Flutter version 3.19.2 on channel stable at /Users/user/fvm/versions/3.19.2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7482962148 (4 weeks ago), 2024-02-27 16:51:22 -0500
• Engine revision 04817c99c9
• Dart version 3.3.0
• DevTools version 2.31.1
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/user/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/user/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15A240d
• CocoaPods version 1.15.0
[✓] Android Studio (version 2023.2)
• 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.9+0-17.0.9b1087.7-11185874)
[✓] VS Code (version 1.87.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.84.0
[✓] Connected device (2 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 14 (API 34) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.0 23A344 darwin-arm64
! Error: Browsing on the local area network for iPhone 11. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• All expected network resources are available.
• No issues found!
Dart Version
No response
Steps to Reproduce
Sorry for my bad English, hope you understand.
When I intentionally parse the json by entering the wrong key, the catch block is not triggered.
Wrong key: title1
Right key: title
Future<void> _testing() async {
final dio = Dio();
try {
final response = await dio.get('https://api.sampleapis.com/coffee/hot');
// ISSUE: "title1" is wrong key. Right key is "title".
final listBody = (response.data as List).map((e) => e['title1'] as String).toList();
for(var i in listBody){
log(i, name: 'Try');
}
} on Exception catch (e) {
log(e.toString(), name: 'Catch');
}
}
JSON:
[
{
"title": "Black Coffee",
"description": "Svart kaffe är så enkelt som det kan bli med malda kaffebönor dränkta i hett vatten, serverat varmt. Och om du vill låta fancy kan du kalla svart kaffe med sitt rätta namn: café noir.",
"ingredients": [
"Coffee"
],
"image": "https://images.unsplash.com/photo-1494314671902-399b18174975?auto=format&fit=crop&q=80&w=1887&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
"id": 1
},
]
Expected Result
catch block triggered when parsing json to an object fails.
Actual Result
catch block NOT triggered when parsing json to an object fails.
The text was updated successfully, but these errors were encountered:
Package
dio
Version
5.4.2
Operating-System
Android, iOS
Adapter
Default Dio
Output of
flutter doctor -v
Dart Version
No response
Steps to Reproduce
Sorry for my bad English, hope you understand.
When I intentionally parse the json by entering the wrong key, the
catch
block is not triggered.Wrong key:
title1
Right key:
title
JSON:
Expected Result
catch
block triggered when parsing json to an object fails.Actual Result
catch
block NOT triggered when parsing json to an object fails.The text was updated successfully, but these errors were encountered: