【问题标题】:Error loading AssetManifest.json, e: Null check operator used on a null value加载 AssetManifest.json 时出错,e:空值检查运算符用于空值
【发布时间】:2021-09-10 23:04:02
【问题描述】:

当我启动我的应用程序时,我得到一个异常Error loading AssetManifest.json, e: Null check operator used on a null value,我不知道它来自哪里。与Null check operator used on a null value 的问题相反,除了这段短代码,我没有在任何地方使用 bang 运算符:

return Text(
      widget.text,
      style: Theme.of(context).textTheme.bodyText1!.copyWith(
        fontWeight: FontWeight.bold
      ),
    );

在此处对这段代码的所有调用后都会引发异常,因此这不是源代码。

我也不知道Error loading AssetManifest.json 是什么意思,只能​​找到类似听起来问题的解决方案,但没有解决我的问题。

我还打开了一个 GitHub 问题,结果为 flutter run --verboseflutter analyzeflutter doctor -vhttps://github.com/flutter/flutter/issues/85457

如果有人能帮助我,那就太好了。

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    在回复https://github.com/material-foundation/google-fonts-flutter/issues/172 之后,我在调用runApp 之前通过在main() 中添加这一行来修复它:

    WidgetsFlutterBinding.ensureInitialized();
    

    【讨论】:

      【解决方案2】:

      原来这是 Google 字体问题,而不是 Flutter 问题。我在这里记录了它:https://github.com/material-foundation/google-fonts-flutter/issues/172

      我是如何解决的:我没有。我现在只是使用嵌入式字体。一位用户在 GitHub 上发布了一个解决方案,所以我可能会稍后尝试。

      【讨论】:

        猜你喜欢
        • 2021-09-01
        • 2021-11-04
        • 2021-12-03
        • 1970-01-01
        • 2021-01-24
        • 2022-07-06
        • 2022-01-18
        • 2021-11-03
        • 2021-12-25
        相关资源
        最近更新 更多