gpt4 book ai didi

flutter - 从 2.8.1 升级到 Flutter 3.0,得到 : Warning: Operand of null-aware operation '?.' has type 'PaintingBinding' which excludes null error

转载 作者:行者123 更新时间:2023-12-05 08:03:32 25 4
gpt4 key购买 nike

从 2.8.1 升级到 Flutter 3.0,得到:Warning: Operand of null-aware operation '?.'具有排除空错误的“PaintingBinding”类型

它在 binding.dart 上——一个我根本不碰的文件。

() => PaintingBinding.instance?.imageCache?.evict(key),
^

你们有没有机会知道我该如何解决它?

不知道是否相关,但也经常看到:

Class 'kotlin.Unit' was compiled with an incompatible version

使用此处的指南进行迁移:https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

这是我的发布规范:

environment:
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter

google_maps_flutter: ^2.0.6
rxdart:
shimmer:
cupertino_icons: ^1.0.3

dependencies:
flutter_svg: ^1.0.0

http: ^0.13.3
flutter_spinkit: ^5.0.0
url_launcher: ^6.0.9
html: ^0.15.0
cached_network_image: ^3.1.0
collection: ^1.15.0
share_plus: ^3.0.4
flutter_native_splash: ^1.3.2


dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.9.2

flutter_icons:
android: true
ios: true
image_path: "assets/app/launch/ic_launcher.png"
adaptive_icon_padding: true

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages

最佳答案

所以,一些对我有帮助的事情:

  1. 删除下一个文件夹/Users/your-user/.pub-cache/hosted/pub.dartlang.org
  2. 点击 flutter pub upgrade

然后尝试运行你的项目 🎉

关于flutter - 从 2.8.1 升级到 Flutter 3.0,得到 : Warning: Operand of null-aware operation '?.' has type 'PaintingBinding' which excludes null error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72222750/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com