Я успешно перешел на Flutter 2.2, но при запуске приложения я получаю сообщение об ошибке, как показано ниже.
../../flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.12.0/lib/src/mapbox_map.dart:14:5: Error: 'required' isn't a type.
required this.initialCameraPosition,
^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/meta.dart:240:16: Context: This isn't a type.
const Required required = Required();
^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.12.0/lib/src/offline_region.dart:7:5: Error: 'required' isn't a type.
required this.bounds,
^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/meta.dart:240:16: Context: This isn't a type.
const Required required = Required();
^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.12.0/lib/src/offline_region.dart:8:5: Error: 'required' isn't a type.
required this.mapStyleUrl,
^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/meta.dart:240:16: Context: This isn't a type.
const Required required = Required();
^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.12.0/lib/src/offline_region.dart:9:5: Error: 'required' isn't a type.
required this.minZoom,
^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/meta.dart:240:16: Context: This isn't a type.
const Required required = Required();
^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/mapbox_gl-0.12.0/lib/src/offline_region.dart:10:5: Error: 'required' isn't a type.
required this.maxZoom,
^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/meta.dart:240:16: Context: This isn't a type.
const Required required = Required();
^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
Кто-нибудь сталкивался с такой проблемой? я использовал mapbox_gl: ^0.12.0
и вывод флаттер доктора
/Users/ramesh.dhoju/Desktop/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5 20G71 darwin-arm, locale en-AU)
• Flutter version 2.2.3 at /Users/ramesh.dhoju/Desktop/flutter
• Framework revision f4abaa0735 (5 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/ramesh.dhoju/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment Zulu11.45+27-CA (build 11.0.10+9-LTS)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2020.3)
• 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
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] Connected device (2 available)
• iPhone 12 Pro Max (mobile) • DC97C1EE-85CE-42A4-854C-6824728C3F55 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.131
! Doctor found issues in 2 categories.
Process finished with exit code 0
Кроме того, когда я провел Dart Analysis, я увидел его высказывание
info: The library 'package:mapbox_gl/mapbox_gl.dart' is legacy, and should not be imported into a null safe library. (import_of_legacy_library_into_null_safe at .........
Я пытался запустить с помощью флаттер-бег --no-sound-null-safety
Также добавлен // @Dart=2.9 в файл main.dart, как предложено (https://dart.dev/null-safety/unsound-null-safety).