rsflutterapp

Bahnhofsfoto-App for Android and iOS using Flutter
git clone git://archive.git.mtrnord.blog/MTRNord/rsflutterapp.git
Log | Files | Refs | README

countries.dart (1780B)


      1 import 'package:equatable/equatable.dart';
      2 import 'package:flutter/cupertino.dart';
      3 
      4 class Country extends Equatable {
      5   final String code;
      6   final String name;
      7   final String email;
      8   final String twitterTags;
      9   final String timetableUrlTemplate;
     10   final String overrideLicense;
     11   final bool active;
     12   final List<ProviderApp> providerApps;
     13 
     14   const Country({
     15     @required this.code,
     16     @required this.name,
     17     @required this.email,
     18     @required this.twitterTags,
     19     this.timetableUrlTemplate,
     20     this.overrideLicense,
     21     @required this.active,
     22     @required this.providerApps,
     23   });
     24 
     25   @override
     26   List<Object> get props => [
     27         code,
     28         name,
     29         email,
     30         twitterTags,
     31         timetableUrlTemplate,
     32         overrideLicense,
     33         active,
     34         providerApps,
     35       ];
     36 
     37   static Country fromJson(dynamic json) {
     38     List<ProviderApp> providerApps = List();
     39     (json["providerApps"] as List).forEach((element) {
     40       providerApps.add(ProviderApp.fromJson(element));
     41     });
     42     return Country(
     43       code: json["code"],
     44       name: json["name"],
     45       email: json["email"],
     46       twitterTags: json["twitterTags"],
     47       timetableUrlTemplate: json["timetableUrlTemplate"],
     48       overrideLicense: json["overrideLicense"],
     49       active: json["active"],
     50       providerApps: providerApps,
     51     );
     52   }
     53 }
     54 
     55 class ProviderApp extends Equatable {
     56   final String type;
     57   final String name;
     58   final String url;
     59 
     60   ProviderApp({
     61     @required this.type,
     62     @required this.name,
     63     @required this.url,
     64   });
     65 
     66   @override
     67   List<Object> get props => [
     68         type,
     69         name,
     70         url,
     71       ];
     72 
     73   static ProviderApp fromJson(dynamic json) {
     74     return ProviderApp(
     75       type: json["type"],
     76       name: json["name"],
     77       url: json["url"],
     78     );
     79   }
     80 }