获取 Flutter Cupertino_icons 依赖错误
Posted
技术标签:
【中文标题】获取 Flutter Cupertino_icons 依赖错误【英文标题】:Getting Flutter Cupertino_icons dependency Error 【发布时间】:2020-05-18 01:37:42 【问题描述】:我的项目中出现此错误。我什至创建了一个新的普通颤振项目,但我也遇到了同样的错误。
我什至尝试清除 flutter.pub-cache\hosted\pub.dartlang.org\cupertino_icons -****。我什至尝试专门给出版本名称。但它仍然无法工作在 abccdddd 中运行“flutter pub get”... 1.0s 在调试模式下在 SM J600G 上启动 lib\main.dart... 正在运行 Gradle 任务 'assembleDebug'...
Compiler message:
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:1:1: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
We:
^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:1:1: Error: Expected ';' after this.
We:
^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:1:3: Error: Expected a declaration, but got ':'.
We:
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:1: Error: Expected a declaration, but got '-'.
- commit this file in order for git to create a lib/ directory, and
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:10: Error: Expected an identifier, but got 'this'.
- commit this file in order for git to create a lib/ directory, and
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:10: Error: Expected ';' after this.
- commit this file in order for git to create a lib/ directory, and
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:15: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
- commit this file in order for git to create a lib/ directory, and
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:15: Error: Expected ';' after this.
- commit this file in order for git to create a lib/ directory, and
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:20: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
- commit this file in order for git to create a lib/ directory, and
^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:20: Error: Expected an identifier, but got 'in'.
- commit this file in order for git to create a lib/ directory, and
^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:20: Error: Expected ';' after this.
- commit this file in order for git to create a lib/ directory, and
^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:23: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
- commit this file in order for git to create a lib/ directory, and
^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:23: Error: Expected ';' after this.
- commit this file in order for git to create a lib/ directory, and
^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:29: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
- commit this file in order for git to create a lib/ directory, and
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:29: Error: Expected an identifier, but got 'for'.
- commit this file in order for git to create a lib/ directory, and
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:29: Error: Expected ';' after this.
- commit this file in order for git to create a lib/ directory, and
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:37: Error: Expected ';' after this.
- commit this file in order for git to create a lib/ directory, and
^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:47: Error: Expected ';' after this.
- commit this file in order for git to create a lib/ directory, and
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:49: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
- commit this file in order for git to create a lib/ directory, and
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:49: Error: Expected ';' after this.
- commit this file in order for git to create a lib/ directory, and
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:52: Error: Expected a declaration, but got '/'.
- commit this file in order for git to create a lib/ directory, and
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:54: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
- commit this file in order for git to create a lib/ directory, and
^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:65: Error: Expected ';' after this.
- commit this file in order for git to create a lib/ directory, and
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:1: Error: Expected a declaration, but got '-'.
- want a lib/ directory so pub will create a well-formed .packages file
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:8: Error: Expected ';' after this.
- want a lib/ directory so pub will create a well-formed .packages file
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:8: Error: 'a' is already declared in this scope.
- want a lib/ directory so pub will create a well-formed .packages file
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:47: Context: Previous declaration of 'a'.
- commit this file in order for git to create a lib/ directory, and
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:10: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
- want a lib/ directory so pub will create a well-formed .packages file
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:10: Error: Expected ';' after this.
- want a lib/ directory so pub will create a well-formed .packages file
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:10: Error: 'lib' is already declared in this scope.
- want a lib/ directory so pub will create a well-formed .packages file
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:49: Context: Previous declaration of 'lib'.
- commit this file in order for git to create a lib/ directory, and
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:13: Error: Expected a declaration, but got '/'.
- want a lib/ directory so pub will create a well-formed .packages file
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:25: Error: Expected ';' after this.
- want a lib/ directory so pub will create a well-formed .packages file
^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:32: Error: Expected ';' after this.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:44: Error: Expected ';' after this.
- want a lib/ directory so pub will create a well-formed .packages file
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:44: Error: 'a' is already declared in this scope.
- want a lib/ directory so pub will create a well-formed .packages file
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:8: Context: Previous declaration of 'a'.
- want a lib/ directory so pub will create a well-formed .packages file
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:46: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:46: Error: Expected ';' after this.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:50: Error: Expected a declaration, but got '-'.
- want a lib/ directory so pub will create a well-formed .packages file
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:68: Error: Expected ';' after this.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:68: Error: 'file' is already declared in this scope.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:15: Context: Previous declaration of 'file'.
- commit this file in order for git to create a lib/ directory, and
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:3: Error: Type 'commit' not found.
- commit this file in order for git to create a lib/ directory, and
^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:33: Error: Type 'git' not found.
- commit this file in order for git to create a lib/ directory, and
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:40: Error: Type 'create' not found.
- commit this file in order for git to create a lib/ directory, and
^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:3: Error: Type 'want' not found.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:15: Error: 'directory' isn't a type.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:54: Context: This isn't a type.
- commit this file in order for git to create a lib/ directory, and
^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:28: Error: Type 'pub' not found.
- want a lib/ directory so pub will create a well-formed .packages file
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:37: Error: Type 'create' not found.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:51: Error: Type 'formed.packages' not found.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^^^^^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:3: Error: 'commit' isn't a type.
- commit this file in order for git to create a lib/ directory, and
^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:33: Error: 'git' isn't a type.
- commit this file in order for git to create a lib/ directory, and
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:2:40: Error: 'create' isn't a type.
- commit this file in order for git to create a lib/ directory, and
^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:3: Error: 'want' isn't a type.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:28: Error: 'pub' isn't a type.
- want a lib/ directory so pub will create a well-formed .packages file
^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:37: Error: 'create' isn't a type.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt:3:51: Error: 'formed.packages' can't be used as a type because 'formed' isn't defined.
- want a lib/ directory so pub will create a well-formed .packages file
^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'E:\Flutter Apps\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'E:\Flutter Apps\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
非常感谢任何帮助
【问题讨论】:
你应该重新安装flutter 【参考方案1】:我打开了 .pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.3/lib/placeholder.txt 文件并清除了它。它开始为我工作。真的很奇怪,但确实如此。
【讨论】:
以上是关于获取 Flutter Cupertino_icons 依赖错误的主要内容,如果未能解决你的问题,请参考以下文章