首页 > 解决方案 > 颤振:添加http依赖项时出错

问题描述

我正在flutter docs中研究flutter 网络。我完全按照指导进行,但是当我添加 http 依赖项然后单击时Packages get出现错误。怎么了?感谢您的任何建议。

dependencies:
  flutter:
    sdk: flutter
  qrscan: ^0.2.17
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3
  http: ^0.12.2  // http dependency I added

错误信息如下

Running "flutter pub get" in myProject...                        
Unexpected character (at character 1)

<html>

^

dart:convert                                       jsonDecode

package:pub/src/source/hosted.dart 190:17          BoundHostedSource._fetchVersions

===== asynchronous gap ===========================

dart:async                                         _CustomZone.runUnary

package:pub/src/rate_limited_scheduler.dart 82:30  RateLimitedScheduler._processNextTask.runJob

package:pub/src/rate_limited_scheduler.dart 85:30  RateLimitedScheduler._processNextTask

dart:async                                         new Future.sync

package:pool/pool.dart 126:18                      Pool.withResource.<fn>

This is an unexpected error. Please run



    pub --trace '--verbosity=warning' get --no-precompile



and include the logs in an issue on https://github.com/dart-lang/pub/issues/new
pub get failed (65; and include the logs in an issue on https://github.com/dart-lang/pub/issues/new)
Process finished with exit code 65

标签: androidflutter

解决方案


dependencies:
 flutter:
  sdk: flutter

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
http: ^0.12.2  // http dependency I added 
qrscan: ^0.2.17 

请按此顺序编写代码


推荐阅读