Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit a9bfb90

Browse files
committed
example(dart/toh-4,5): getHeroesSlowly() to return getHeroes()
Have `getHeroesSlowly()` delay and then return the value of `getHeroes()`. This makes it easier for user’s performing the tutorial to keep this slower method as they evolve toh-5 into toh-6.
1 parent 07f0774 commit a9bfb90

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class HeroService {
1717
// See the "Take it slow" appendix
1818
// #docregion get-heroes-slowly
1919
Future<List<Hero>> getHeroesSlowly() {
20-
return new Future.delayed(const Duration(seconds: 2), () => mockHeroes);
20+
return new Future.delayed(const Duration(seconds: 2), getHeroes);
2121
}
2222
// #enddocregion get-heroes-slowly
2323
// #docregion

public/docs/_examples/toh-4/dart/lib/hero_service_1.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class HeroService {
1313
// #enddocregion getHeroes-stub, empty-class, final
1414
/*
1515
// #docregion getHeroes-stub
16-
List<Hero> getHeroes() {}
16+
List<Hero> getHeroes() {} // stub
1717
// #enddocregion getHeroes-stub
1818
*/
1919
// #docregion final

public/docs/_examples/toh-5/dart/lib/hero_service.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import 'mock_heroes.dart';
1010
class HeroService {
1111
Future<List<Hero>> getHeroes() async => mockHeroes;
1212

13-
// See the "Take it slow" appendix
1413
Future<List<Hero>> getHeroesSlowly() {
1514
return new Future<List<Hero>>.delayed(
16-
const Duration(seconds: 2), () => mockHeroes);
15+
const Duration(seconds: 2), getHeroes);
1716
}
1817

1918
// #docregion getHero

0 commit comments

Comments
 (0)