I use a Flutter and faces the following warning with analysis_options.yaml.
Missing type arguments for map literal.
Try adding an explicit type like 'dynamic', or enable implicit-dynamic in your analysis options file.
The code is as follows.
Map<String, dynamic> toJson() => {
'name': name,
'isEnabled': isEnabled,
};
How can I fix this warning?
flutter doctor
C:\src\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [Version 10.0.18363.1082], locale ja-JP)
• Flutter version 1.20.4 at C:\src\flutter
• Framework revision fba99f6cf9 (5 days ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
• Android SDK at C:\Users\user\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 48.1.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
Solved with following codes.
Map<String, dynamic> toJson() => <String, dynamic>{
'name': name,
'isEnabled': isEnabled,
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With