Patrice Chalin da48db3c77 docs(server-communication): cleanup, mainly for Dart (#1455)
- Dart code: fix issues raised by @thso during review.
- Dart code: remove "show x" clauses from imports.
- Dart add docsync config file.
- Prose: make consistent use of _Http variables; otherwise use "HTTP".
- Prose: add links to the demos list.

* _heroesUrl as static const
2016-05-20 17:14:37 -07:00

15 lines
296 B
Dart

// #docregion
int _toInt(id) => id is int ? id : int.parse(id);
class Hero {
final int id;
final String name;
Hero(this.id, this.name);
factory Hero.fromJson(Map<String, dynamic> hero) =>
new Hero(_toInt(hero['id']), hero['name']);
Map toJson() => {'id': id, 'name': name};
}