stations.dart (1751B)
1 import 'package:equatable/equatable.dart'; 2 import 'package:flutter/cupertino.dart'; 3 4 class Station extends Equatable { 5 final String country; 6 final String idStr; 7 final int id; 8 final String title; 9 final double lat; 10 final double lon; 11 final String photographer; 12 final String photographerUrl; 13 final String photoUrl; 14 final String license; 15 final String licenseUrl; 16 final int createdAt; 17 final bool active; 18 final String ds100; 19 20 Station({ 21 @required this.country, 22 @required this.idStr, 23 @required this.id, 24 @required this.title, 25 @required this.lat, 26 @required this.lon, 27 @required this.photographer, 28 @required this.photographerUrl, 29 @required this.photoUrl, 30 @required this.license, 31 @required this.licenseUrl, 32 @required this.createdAt, 33 @required this.active, 34 @required this.ds100, 35 }); 36 37 @override 38 List<Object> get props => [ 39 country, 40 idStr, 41 id, 42 title, 43 lat, 44 lon, 45 photographer, 46 photographerUrl, 47 photoUrl, 48 license, 49 licenseUrl, 50 createdAt, 51 active, 52 ds100, 53 ]; 54 55 static Station fromJson(dynamic json) { 56 return Station( 57 country: json["country"] ?? "", 58 idStr: json["idStr"] ?? "", 59 id: json["id"] ?? -1, 60 title: json["title"] ?? "", 61 lat: json["lat"] ?? 0, 62 lon: json["lon"] ?? 0, 63 photographer: json["photographer"] ?? "", 64 photographerUrl: json["photographerUrl"] ?? "", 65 photoUrl: json["photoUrl"] ?? "", 66 license: json["license"] ?? "", 67 licenseUrl: json["licenseUrl"] ?? "", 68 createdAt: json["createdAt"] ?? 0, 69 active: json["active"] ?? false, 70 ds100: json["DS100"] ?? "", 71 ); 72 } 73 }