examples(toh-6/dart): support case where `_initialHeroes` is empty

Fixes https://github.com/angular-examples/toh-6/issues/2
This commit is contained in:
Patrice Chalin 2016-11-28 18:00:47 -08:00 committed by Kathy Walrath
parent 7dac7f8f6f
commit 6d1c468bac
1 changed files with 1 additions and 1 deletions

View File

@ -25,7 +25,7 @@ class InMemoryDataService extends MockClient {
]; ];
static final List<Hero> _heroesDb = static final List<Hero> _heroesDb =
_initialHeroes.map((json) => new Hero.fromJson(json)).toList(); _initialHeroes.map((json) => new Hero.fromJson(json)).toList();
static int _nextId = _heroesDb.map((hero) => hero.id).reduce(max) + 1; static int _nextId = _heroesDb.map((hero) => hero.id).fold(0, max) + 1;
static Future<Response> _handler(Request request) async { static Future<Response> _handler(Request request) async {
var data; var data;