- 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
		
			
				
	
	
		
			15 lines
		
	
	
		
			296 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			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};
 | |
| }
 |