angular-cn/public/docs/_examples/toh-4/dart/lib/hero_service.dart

27 lines
629 B
Dart
Raw Normal View History

// #docplaster
// #docregion
// #docregion just-get-heroes
import 'dart:async';
import 'package:angular2/core.dart';
import 'hero.dart';
import 'mock_heroes.dart';
@Injectable()
class HeroService {
// #docregion get-heroes
Future<List<Hero>> getHeroes() async => mockHeroes;
2016-06-15 17:58:05 -04:00
// #enddocregion get-heroes, just-get-heroes
// #enddocregion
// See the "Take it slow" appendix
// #docregion get-heroes-slowly
Future<List<Hero>> getHeroesSlowly() {
return new Future.delayed(const Duration(seconds: 2), () => mockHeroes);
}
// #enddocregion get-heroes-slowly
2016-06-15 17:58:05 -04:00
// #docregion
// #docregion just-get-heroes
}
2016-06-15 17:58:05 -04:00