Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A null check operator error caused a crash | 一个判定空值的符号错误导致了程序无法编译成功 #110

Closed
lilpard-mk opened this issue Mar 20, 2021 · 2 comments

Comments

@lilpard-mk
Copy link

When I was openning my build App, the App board was totally blank, and the error info is below:

Debug service listening on ws://127.0.0.1:50935/nmjD2HWXneA=/ws
Syncing files to device macOS...
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Null check operator used on a null value
#0 new BotToastWidgetsBindingObserver._ (package:bot_toast/src/bot_toast_init.dart:15:28)
#1 BotToastWidgetsBindingObserver._singleton (package:bot_toast/src/bot_toast_init.dart:21:38)
#2 BotToastWidgetsBindingObserver._singleton (package:bot_toast/src/bot_toast_init.dart)
#3 BotToastInit (package:bot_toast/src/bot_toast_init.dart:49:34)
#4 main (package:new_flutter_app/main.dart:86:14)
#5 _runMainZoned.. (dart:ui/hooks.dart:146:25)
#6 _rootRun (dart:async/zone.dart:1354:13)
#7 _CustomZone.run (dart:async/zone.dart:1258:19)
#8 _runZoned (dart:async/zone.dart:1789:10)
#9 runZonedGuarded (dart:async/zone.dart:1777:12)
#10 _runMainZoned. (dart:ui/hooks.dart:139:5)
#11 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:283:19)
#12 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

Then I changed the null check operator '!' to '?' on 'bot_toast/src/bot_toast_init.dart:15:28' , and then everything is just fine.

Wish this bug would be fixed in future.

@MMMzq
Copy link
Owner

MMMzq commented Mar 22, 2021

你可以试试下面这种方式或者升级Flutter:

void main() {
  WidgetsFlutterBinding.ensureInitialized(); //添加这行
  runApp(MyApp());
}

@lilpard-mk
Copy link
Author

已更改,flutter是最新版,目前一切正常,感谢回复!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants