【问题标题】:Unhandled Exception: Invalid argument (computation): The type parameter is not nullable: null未处理的异常:无效参数(计算):类型参数不可为空:null
【发布时间】:2021-12-31 02:51:12
【问题描述】:

尝试在 android Studio 中运行以下 Flutter 代码

github上的代码链接 https://github.com/cyeh1234/bloc_bug.git

得到以下错误:

https://www.mitrais.com/news-updates/getting-started-with-flutter-bloc-pattern/

正确的输出

【问题讨论】:

    标签: flutter flutter-bloc


    【解决方案1】:

    删除 <int> 将解决此问题。

    await Future.delayed(Duration(seconds: 3));
    

    【讨论】:

      【解决方案2】:

      如果您需要指定类型注释,请使用:

      await Future<dynamic>.delayed(Duration(seconds: 3));
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-08-15
        • 1970-01-01
        • 1970-01-01
        • 2023-03-17
        • 2015-06-07
        • 1970-01-01
        • 2020-07-26
        • 1970-01-01
        相关资源
        最近更新 更多