【问题标题】:The argument type 'Null' can't be assigned to the parameter type 'String'. Flutter Issue参数类型“Null”不能分配给参数类型“String”。颤振问题
【发布时间】:2021-11-12 20:27:12
【问题描述】:
  @override
  Widget? buildLeading(BuildContext context) {
    return IconButton(
      icon: AnimatedIcon(
        icon: AnimatedIcons.menu_arrow,
        progress: transitionAnimation,
      ),
      onPressed: () {
        close(context, null);
      },
    );
  }

Null 导致问题

请尽快解决这个颤振问题

【问题讨论】:

  • 添加close函数的部分代码。这样别人就可以建议你应该怎么做。

标签: flutter null flutter-widget


【解决方案1】:

这是因为 Flutter null 安全功能而发生的 试试这个,

onPressed: () {
                 close(context, '');
              },

传递空字符串,由于flutter null安全性,您不能分配空值。

【讨论】:

    猜你喜欢
    • 2019-12-29
    • 2018-04-05
    • 1970-01-01
    • 2021-11-28
    • 1970-01-01
    • 2021-09-30
    • 2021-10-02
    • 1970-01-01
    • 2020-11-15
    相关资源
    最近更新 更多