我去年开始学习flutter,创建了一个运行良好的小项目,直到现在才停止学习......
所以今天,将 flutter 更新到最新版本(2.5.0)并再次开始运行该项目后,在尝试再次运行它时遇到了此错误:
Launching lib\order_route.dart on ASUS X01BDA in debug mode...
Running Gradle task 'assembleDebug'...
/D:/progie/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widgets-0.1.12/lib/src/tagged_text/tagged_text.dart:295:36: Error: No named parameter with the name 'nullOk'.
MediaQuery.of(context, nullOk: true)?.textScaleFactor ??
^^^^^^
/D:/progie/flutter/packages/flutter/lib/src/widgets/media_query.dart:841:25: Context: Found this candidate, but the arguments don't match.
static MediaQueryData of(BuildContext context) {
^^
/D:/progie/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widgets-0.1.12/lib/src/feature_discovery/src/overlay_widgets.dart:239:20: Error: The getter 'title' isn't defined for the class 'TextTheme'.
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/D:/progie/flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'title'.
style: theme.title.copyWith(color: Colors.white),
^^^^^
/D:/progie/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widgets-0.1.12/lib/src/feature_discovery/src/overlay_widgets.dart:248:20: Error: The getter 'subhead' isn't defined for the class 'TextTheme'.
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/D:/progie/flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'subhead'.
style: theme.subhead.copyWith(color: Colors.white70),
^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\progie\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\progie\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 14s
Exception: Gradle task assembleDebug failed with exit code 1
Run Code Online (Sandbox Code Playgroud)
我已经做了什么:
但根本没有帮助
我使用的是android studio 4.1版本
从错误来看,代码有 700 行左右,但我不知道哪个部分生成了上述错误,而且我什至没有在代码中使用 TextTheme 或 MediaQuery。
运行酒吧已过时:
Showing outdated packages.
[*] indicates versions that are not the latest available.
Package Name Current Upgradable Resolvable Latest
direct dependencies: all up-to-date.
transitive dependencies:
async *2.8.1 *2.8.1 *2.8.1 2.8.2
characters *1.1.0 *1.1.0 *1.1.0 1.2.0
csslib *0.16.2 *0.16.2 *0.16.2 0.17.0
html *0.14.0+4 *0.14.0+4 *0.14.0+4 0.15.0
matcher *0.12.10 *0.12.10 *0.12.10 0.12.11
quiver *2.1.5 *2.1.5 *2.1.5 3.0.1
transitive dev_dependencies:
test_api *0.4.2 *0.4.2 *0.4.2 0.4.3
all dependencies are up-to-date.
Process finished with exit code 0
Run Code Online (Sandbox Code Playgroud)
问题与上面的依赖关系有关吗?
任何帮助将非常感激,提前谢谢您!
在过去的一年里,flutter 发生了很多事情。升级到 2.5 意味着您的 flutter 项目将具有 null 安全性,并且您可能需要将任何依赖项更新到可能支持 null 安全性的最新版本。所以错误来自 flutter widgets 包。如果您检查https://pub.dev/packages/flutter_widgets,它会显示该软件包不再更新,因此它已过时,建议您使用可用的替代方案之一。
| 归档时间: |
|
| 查看次数: |
16706 次 |
| 最近记录: |