【问题标题】:Your application could not be compiled, because its dependencies could not be established in flutter您的应用程序无法编译,因为它的依赖项无法在颤振中建立
【发布时间】:2019-02-13 06:25:17
【问题描述】:

https://gist.github.com/bugudiramu/2c73f41a29ec8cd07dc7a592aaea3c65

尝试解析此 Dart 文件以查找其依赖项时: F:\flutter.pub-cache\hosted\pub.dartlang.org\http-0.12.0+1\lib\http.dart ...分析仪因以下错误而失败: F:\flutter.pub-cache\hosted\pub.dartlang.org\http-0.12.0+1\lib\http.dart 中的错误:应找到';'。

【问题讨论】:

  • 我用它 import 'package:http/http.dart' as http;

标签: flutter


【解决方案1】:

检查您的导入语句,因为它的末尾缺少分号 ;

import 'package:http/http.dart';

【讨论】:

    【解决方案2】:

    似乎缓存包中的文件已损坏。

    修复运​​行

    flutter packages pub cache repair
    

    【讨论】:

    • 它刚刚工作。非常感谢我花了 2 天时间才找到解决方案。谢谢。
    • 你在使用 VSCode 吗? AndroidStudio 和 IntelliJ 应防止意外编辑此类文件。据我所知,不久前在 VSCode 中也进行了一项更改,以防止这种情况发生,我预计这已经落地了。
    • 确保您拥有最新版本的 DartCode 插件。如果您再次看到它,请将其报告为 github.com/Dart-Code/Dart-Code/issues 中的错误(带有指向此问题的链接)
    猜你喜欢
    • 2019-05-08
    • 2018-08-21
    • 2020-10-12
    • 2019-05-18
    • 2019-12-12
    • 1970-01-01
    • 1970-01-01
    • 2020-04-07
    • 2019-11-02
    相关资源
    最近更新 更多