From 6d1c468bac44f67dbf76c871e2ba030ba14d4dd5 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Mon, 28 Nov 2016 18:00:47 -0800 Subject: [PATCH] examples(toh-6/dart): support case where `_initialHeroes` is empty Fixes https://github.com/angular-examples/toh-6/issues/2 --- .../docs/_examples/toh-6/dart/lib/in_memory_data_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/docs/_examples/toh-6/dart/lib/in_memory_data_service.dart b/public/docs/_examples/toh-6/dart/lib/in_memory_data_service.dart index 5be0f9e8c4..2472a4f4a5 100644 --- a/public/docs/_examples/toh-6/dart/lib/in_memory_data_service.dart +++ b/public/docs/_examples/toh-6/dart/lib/in_memory_data_service.dart @@ -25,7 +25,7 @@ class InMemoryDataService extends MockClient { ]; static final List _heroesDb = _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 _handler(Request request) async { var data;