Angular 2 + Dart依赖项:URI的目标不存在:'package:http / browser_client.dart';

时间:2016-11-11 19:04:14

标签: angular dependencies dart angular-dart

这可能是一个新手问题,但我找不到问题:我正在尝试使用Angular 2 + Dart创建一个应用程序。这是我的/pubspec.yaml文件:

name: ad_checkout
description: A Dart app that uses Angular 2
version: 0.0.1
environment:
  sdk: '>=1.19.0 <2.0.0'
dependencies:
  angular2: ^2.0.0
dev_dependencies:
  browser: ^0.10.0
  dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
    platform_directives:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    platform_pipes:
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points: web/main.dart
    resolved_identifiers:
      BrowserClient: 'package:http/browser_client.dart'
      Client: 'package:http/http.dart'
- dart_to_js_script_rewriter

我正在使用IntelliJ IDEA并尝试按照教程启用ajax调用:https://angular.io/docs/dart/latest/tutorial/toh-pt6.html

这是我的web / main.dart文件:

import 'package:angular2/platform/browser.dart';
import 'package:http/browser_client.dart';

import 'package:ad_checkout/app_component.dart';

void main() {
  bootstrap(AppComponent,[
    provide(BrowserClient, useFactory: () => new BrowserClient(), deps: [])
  ]);
}

在IntelliJ中,我尝试了“获取依赖关系”,“更新依赖关系”和“清除缓存”没有任何帮助。我错过了什么?

1 个答案:

答案 0 :(得分:4)

http的{​​{1}}部分下没有列出dependencies:

pubspec.yaml的{​​{1}}下添加http: ^0.11.3