Flutter 颤振错误突然命名参数子项未定义

Flutter 颤振错误突然命名参数子项未定义,flutter,android-studio,Flutter,Android Studio,我换了笔记本电脑,重新安装了android studio和Flatter 之前没有任何错误和警告的应用程序突然开始抛出错误和警告 以下是错误代码: onTap: () async { showDialog( context: context, child: Container(

我换了笔记本电脑,重新安装了android studio和Flatter

之前没有任何错误和警告的应用程序突然开始抛出错误和警告

以下是错误代码:

          onTap: () async {
                          showDialog(
                              context: context,
                              child: Container(
                                  height: 30,
                                  width: 30,
                                  child: Center(
                                      child: CupertinoActivityIndicator(
                                    key: UniqueKey(),
                                    radius: 20,
                                    animating: true,
                                  ))));
                          await handleFacebookLogin(context).then((user) {
                            navigationCheck(user, context);
                          }).then((_) {
                            Navigator.pop(context);
                          }).catchError((e) {
                            Navigator.pop(context);
                          });
                        },
它以前工作得很好,在新的安装上抛出错误似乎有点奇怪,有人能告诉我这里有什么问题吗

到目前为止我所尝试的:

          onTap: () async {
                          showDialog(
                              context: context,
                              child: Container(
                                  height: 30,
                                  width: 30,
                                  child: Center(
                                      child: CupertinoActivityIndicator(
                                    key: UniqueKey(),
                                    radius: 20,
                                    animating: true,
                                  ))));
                          await handleFacebookLogin(context).then((user) {
                            navigationCheck(user, context);
                          }).then((_) {
                            Navigator.pop(context);
                          }).catchError((e) {
                            Navigator.pop(context);
                          });
                        },
  • 通过运行

    flatter clean缓存

  • 然后使缓存无效/重新启动Android Studio

  • 重新启动dart分析服务器
  • 但问题仍然是一样的

    需要
    上下文
    生成器
    ,而不是
    子对象

    试试这个:

    onTap: () async {
       showDialog(
           context: context,
           builder: (BuildContext context) { 
               return Container(
                   height: 30,
                   width: 30,
                   child: Center(
                       child: CupertinoActivityIndicator(
                           key: UniqueKey(),
                           radius: 20,
                           animating: true,
                   ))));
                       
    

    这是因为dart/FLIFT的一些最新更新吗?因为同样的代码在10到15天前还在运行,而现在它又出现了问题?我不知道。你在以前的项目中使用了相同的Dart版本吗?是的,完全相同的版本。我的解决方案有效吗?是的,它消除了上面提到的错误,但是有些奇怪的事情正在发生,现在它导致编译错误,这真的很奇怪,在任何情况下,我都会一次启动并调试一个错误