[英]Angular Dart tutorial section 4 - 'Future not resolved'
Total newbie to Dart and Angular. Dart和Angular的新手总数。 Long-time SW developer with a lot of experience with multiple languages and platforms.
长期的SW开发人员,在多种语言和平台方面拥有丰富的经验。
I'm working through the 'Tour of Heroes' tutorial, but am stumped in section 4. , under the heading 'The Hero Service returns a Future'. 我正在研究“英雄之旅”教程,但在第4节 “英雄服务返回未来”下陷入了困境。
Thus far, I've gotten things to work pretty well, but now when I try to mod the code to return a future (per the tutorial), I get an error. 到目前为止,我已经做得很好,但是现在当我尝试修改代码以返回未来时(根据本教程),我得到了一个错误。
In hero_service.dart, this: 在hero_service.dart中,这是:
Future<List<Hero>> getHeroes() async => mockHeroes;
and in app_component.dart, this: 在app_component.dart中,这是:
Future<Null> getHeroes() async {
heroes = await _heroService.getHeroes();
}
But, I'm getting this error: 但是,我收到此错误:
EXCEPTION: 'package:Tour_Of_Heroes/app_component.dart': malformed type: line
86 pos 3: cannot resolve class 'Future' from 'AppComponent'
Future<Null> getHeroes() async {
^
I've backed it out and re-entered everything to make sure I've entered everything correctly and still getting the error. 我已将其撤消并重新输入所有内容,以确保我正确输入了所有内容并仍然收到错误。
I'm wondering if something in the core was refactored and I need to import something else or clean the build (not sure how to do that...) to get it fresh or what. 我想知道核心中的某些内容是否已重构,是否需要导入其他内容或清理内部版本(不确定如何执行此操作...)以使其新鲜或更新。
(BTW: Doing everything from the CL and VIM. Webstorm was a disaster...) (顺便说一句:从CL和VIM进行所有操作。Webstorm真是一场灾难...)
Remember to add import 'dart:async';
记住添加
import 'dart:async';
? ? (The library that
Future
is in.) (
Future
所在的库。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.