Flutter 3.0 shows error : WidgetsBinding.instance!.addPostFrameCallback((_) => widget.onReady.call());
Flutter 3.0 shows error : WidgetsBinding.instance!.addPostFrameCallback((_) => widget.onReady.call());
flutter 3.0升级工程后出现如下错误
Syncing files to device iPhone 13 Pro Max...
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/another_transformer_page_view-1.1.0/lib/src/another_transformer_page_view.dart:519:22: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addPostFrameCallback(_onGetSize);
^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/another_transformer_page_view-1.1.0/lib/src/another_transformer_page_view.dart:537:22: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addPostFrameCallback(_onGetSize);
^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_login-3.2.0/lib/src/widgets/animated_text.dart:57:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addPostFrameCallback((_) {
^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_select-5.2.0/lib/src/widget.dart:1547:58: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
MediaQueryData.fromWindow(WidgetsBinding.instance!.window);
^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_select-5.2.0/lib/src/text_error.dart:99:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addPostFrameCallback((_) {
这是 flutter 的 bug?任何人都可以将此报告给 flutter。我不知道如何将此报告给 flutter 团队。
This Warning bug is resolved. see my comment in correct answer I have written ( if you are a mac user goto finder -> press goto button by swift+cmd+G -> past all 6 files I have mentioned or you find an error and replace [root-name] with your root directory name.
这是你在项目中使用的库的错误,别担心。它将在 lib
的下一个版本依赖项中修复
或者你可以从 lib 中 fork 代码,修复它,然后创建一个 pull request 到 main
使用
cached_network_image:
git:
url: https://github.com/XuannThucc/flutter_cached_network_image.git
path: cached_network_image
ref: ff72f00f142f13d889d7549e013af91cb0b523ab
而不是
cached_network_image: ^3.2.0
或等待更新cached_network_image: ^3.2.1
'WidgetsBinding.instance' getter 曾经是可空类型。在新的更新中,它被更改为 Non-nullable。因此,现在旧包在更新后会显示此信息,因为它们在那里使用了 null 感知运算符。它将在新版本中修复。现在,您只需从日志中显示的行中删除空感知运算符,重建后将不会再有警告。
flutter 3.0升级工程后出现如下错误
Syncing files to device iPhone 13 Pro Max...
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/another_transformer_page_view-1.1.0/lib/src/another_transformer_page_view.dart:519:22: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addPostFrameCallback(_onGetSize);
^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/another_transformer_page_view-1.1.0/lib/src/another_transformer_page_view.dart:537:22: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addPostFrameCallback(_onGetSize);
^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_login-3.2.0/lib/src/widgets/animated_text.dart:57:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addPostFrameCallback((_) {
^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_select-5.2.0/lib/src/widget.dart:1547:58: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
MediaQueryData.fromWindow(WidgetsBinding.instance!.window);
^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/awesome_select-5.2.0/lib/src/text_error.dart:99:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addPostFrameCallback((_) {
这是 flutter 的 bug?任何人都可以将此报告给 flutter。我不知道如何将此报告给 flutter 团队。
This Warning bug is resolved. see my comment in correct answer I have written ( if you are a mac user goto finder -> press goto button by swift+cmd+G -> past all 6 files I have mentioned or you find an error and replace [root-name] with your root directory name.
这是你在项目中使用的库的错误,别担心。它将在 lib
的下一个版本依赖项中修复或者你可以从 lib 中 fork 代码,修复它,然后创建一个 pull request 到 main
使用
cached_network_image:
git:
url: https://github.com/XuannThucc/flutter_cached_network_image.git
path: cached_network_image
ref: ff72f00f142f13d889d7549e013af91cb0b523ab
而不是
cached_network_image: ^3.2.0
或等待更新cached_network_image: ^3.2.1
'WidgetsBinding.instance' getter 曾经是可空类型。在新的更新中,它被更改为 Non-nullable。因此,现在旧包在更新后会显示此信息,因为它们在那里使用了 null 感知运算符。它将在新版本中修复。现在,您只需从日志中显示的行中删除空感知运算符,重建后将不会再有警告。