期待活页夹但结果为空

问题描述 投票:0回答:5

我在日志中收到此消息,尽管一切正常

W/Parcel: Expecting binder but got null!

有人遇到过这样的问题吗?如何解决?

重现步骤:

  1. 只需创建一个新的 Flutter 项目并在模拟器/仿真器上运行它
  2. 查看日志,您将收到此消息:“期待活页夹但为空”

预期行为:

  1. 不应该有这样的错误信息

跑步日志

Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app-debug.apk...
Debug service listening on ws://127.0.0.1:62931/5G0AlEiF5bQ=/ws
Syncing files to device sdk gphone64 x86 64...
I/.flutter_issues(17884): Compiler allocated 4533KB to compile void android.view.ViewRootImpl.performTraversals()
E/SurfaceSyncer(17884): Failed to find sync for id=0
W/Parcel  (17884): Expecting binder but got null!
flutter dart widgetsbinding
5个回答
12
投票

尝试在

main()
函数中添加以下行

WidgetsFlutterBinding.ensureInitialized();

如果这不起作用,请检查您传递给

initialBinding:
中的
MaterialApp()
的值是否不为空。


6
投票

字面意思

文件 -> 使缓存无效 -> 清除文件系统缓存

然后重建为我修复了它(React Native 0.68.2)


3
投票

该消息实际上不会影响应用程序的功能。但您仍然可以在

main()
中添加一行。在主函数中添加
WidgetsFlutterBinding.ensureInitialized();

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}

0
投票

如果之前工作正常,请停止并重新启动模拟器。它对我有用。


-1
投票

我有 super.build();无缘无故地在我的小部件中。只是忘记删除代码了。所以我删除了代码并修复了。

class _VehicleAddState extends State<VehicleAdd>
    with AutomaticKeepAliveClientMixin<VehicleAdd> {
  double selectedMenu = 0;
  @override
  Widget build(BuildContext context) {
    super.build(context);
© www.soinside.com 2019 - 2024. All rights reserved.