首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >颤振错误脚本'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle‘行: 1102

颤振错误脚本'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle‘行: 1102
EN

Stack Overflow用户
提问于 2022-03-22 23:17:54
回答 3查看 6.4K关注 0票数 4

你好,我有一个颤振错误,虽然我没有任何错误的代码。这都是错误:

代码语言:javascript
运行
复制
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/delegate_widget.dart:194:18: Error: Superclass has no method named 'inheritFromElement'.
    return super.inheritFromElement(ancestor, aspect: aspect);
                 ^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
        ? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
        : context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s
Exception: Gradle task assembleDebug failed with exit code 1

错误码

我把版本降到了1.12.15,什么也没偷

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2022-03-23 11:00:47

在重新启动个人电脑后,我也遇到了同样的问题。

尝试以下任何一种方法:

升级pubspec.yaml中的依赖项

尝试颤振flutter clean然后flutter run

最后,如果它不能工作,您必须删除Script 'C:\src\flutter中的flutter文件夹,然后重新安装它。

确保创建的路径没有空格。

票数 4
EN

Stack Overflow用户

发布于 2022-04-27 20:51:16

删除您的颤振文件夹并重新安装它。我面对这个问题,克服了这种情况。

票数 0
EN

Stack Overflow用户

发布于 2022-06-30 12:33:58

最有效的解决方案是删除Sdk并下载新的

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71580071

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档