【发布时间】:2021-01-30 21:19:36
【问题描述】:
更新 pubspec.yaml 文件后出现错误 例如我正在尝试添加 fluttertoast:^7.1.1 pubspec.yaml 中的依赖项和 import 'package:fluttertoast/fluttertoast.dart'; 在 main.dart 中
当我运行这个项目时出错:
Running Xcode build...
Xcode build done. 8.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
lib/main.dart:29:9: Error: No named parameter with the name 'visualDensity'.
visualDensity: VisualDensity.adaptivePlatformDensity,
^^^^^^^^^^^^^
../../../flutter/packages/flutter/lib/src/material/theme_data.dart:201:11: Context: Found this candidate, but the arguments don't
match.
factory ThemeData({
^
../../../flutter/packages/flutter/lib/src/widgets/media_query.dart:126:32: Error: The getter 'physicalDepth' isn't defined for the
class 'Window'.
- 'Window' is from 'dart:ui'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'physicalDepth'.
physicalDepth = window.physicalDepth,
^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 8.
任何人都有一步一步的解决方案。
提前谢谢你。
【问题讨论】:
-
你试过 Flutter pub get 了吗?
-
是的,也试试
-
看来你的实现是这里的问题。从上面的错误消息来看,您对 VisualDensity 的使用是问题所在。请尝试以下任一答案:
标签: flutter dart flutter-dependencies