无法将参数类型 'Null' 分配给参数类型 'String'。颤动问题

The argument type 'Null' can't be assigned to the parameter type 'String'. Flutter Issue

  @override
  Widget? buildLeading(BuildContext context) {
    return IconButton(
      icon: AnimatedIcon(
        icon: AnimatedIcons.menu_arrow,
        progress: transitionAnimation,
      ),
      onPressed: () {
        close(context, null);
      },
    );
  }

Null 导致了麻烦

请尽快解决这个抖动问题

它的发生是因为 flutter null 安全特性 试试这个,

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

传递空字符串,因为 flutter null safety 你不能赋空值。