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

Commit 6d1c468

Browse files
chalinkwalrath
authored andcommitted
examples(toh-6/dart): support case where _initialHeroes is empty
Fixes https://github.com/angular-examples/toh-6/issues/2
1 parent 7dac7f8 commit 6d1c468

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

public/docs/_examples/toh-6/dart/lib/in_memory_data_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class InMemoryDataService extends MockClient {
2525
];
2626
static final List<Hero> _heroesDb =
2727
_initialHeroes.map((json) => new Hero.fromJson(json)).toList();
28-
static int _nextId = _heroesDb.map((hero) => hero.id).reduce(max) + 1;
28+
static int _nextId = _heroesDb.map((hero) => hero.id).fold(0, max) + 1;
2929

3030
static Future<Response> _handler(Request request) async {
3131
var data;

0 commit comments

Comments
 (0)