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:
parent
7dac7f8f6f
commit
6d1c468bac
|
@ -25,7 +25,7 @@ class InMemoryDataService extends MockClient {
|
|||
];
|
||||
static final List<Hero> _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<Response> _handler(Request request) async {
|
||||
var data;
|
||||
|
|
Loading…
Reference in New Issue