Flutter 未处理的异常:热重载后 cloud_firestore 上的堆栈溢出
Posted
技术标签:
【中文标题】Flutter 未处理的异常:热重载后 cloud_firestore 上的堆栈溢出【英文标题】:Flutter Unhandled Exception: Stack Overflow on cloud_firestore after hot reload 【发布时间】:2021-11-04 19:10:18 【问题描述】:当前正在使用 Flutter Firestore 更新到最新版本后开始导致问题应用程序运行良好,但是当我单击 热重载 时它开始显示此错误。
我认为缓存可能有问题。所以我确实flutter clean,但结果是一样的。
这里是我使用 cloud_firestore 的版本:^2.5.1
E/flutter (22725): #0 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #1 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #2 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #3 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #4 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #5 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #6 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #7 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #8 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #9 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #10 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #11 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #12 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #14 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): ...
E/flutter (22725): ...
E/flutter (22725): #13207 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13208 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13209 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13210 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13211 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13212 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13213 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13214 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13215 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13216 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13217 main (file:///...../FlutterProject/bntbladi/.dart_tool/flutter_build/generated_main.dart:51:40)
E/flutter (22725): #13218 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:140:38)
E/flutter (22725): #13219 _rootRun (dart:async/zone.dart:1428:13)
E/flutter (22725): #13220 _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter (22725): #13221 _runZoned (dart:async/zone.dart:1863:10)
E/flutter (22725): #13222 runZonedGuarded (dart:async/zone.dart:1851:12)
E/flutter (22725): #13223 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:138:5)
E/flutter (22725): #13224 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:283:19)
E/flutter (22725): #13225 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)```
【问题讨论】:
每当您对项目进行更改时(例如添加包、编辑 android/ios 文件。您必须关闭当前调试会话,在终端flutter clean
、flutter pub get
上运行,然后重新运行您的应用
【参考方案1】:
尝试从您的pubspec.yaml
文件中卸载cloud_firestore
,
运行flutter pub get
,最后重新安装cloud_firestore
。它应该可以工作。
【讨论】:
请在您的回答中提供更多详细信息。正如目前所写的那样,很难理解您的解决方案。以上是关于Flutter 未处理的异常:热重载后 cloud_firestore 上的堆栈溢出的主要内容,如果未能解决你的问题,请参考以下文章