当我启动应用程序时,我得到一个异常Error loading AssetManifest.json, e: Null check operator used on a null value
,我不知道它来自哪里。与在Null值上使用的Null检查运算符的问题相反,除了这个简短的代码段:之外,我在任何地方都没有使用bang运算符
return Text(
widget.text,
style: Theme.of(context).textTheme.bodyText1!.copyWith(
fontWeight: FontWeight.bold
),
);
异常是在所有对此代码的调用之后抛出的,因此这不可能是源代码。
我也不知道Error loading AssetManifest.json
是什么意思,只能找到类似问题的解决方案,但没有解决我的问题。
我还打开了一个GitHub问题,其中包含flutter run --verbose
、flutter analyze
和flutter doctor -v
的结果:https://github.com/flutter/flutter/issues/85457
如果有人能帮助我就太好了。
回复https://github.com/material-foundation/google-fonts-flutter/issues/172,我通过在调用runApp
:之前在main()
中添加此行来修复它
WidgetsFlutterBinding.ensureInitialized();