workouttest_app/lib/model/sport.dart
2021-05-02 17:12:42 +02:00

23 lines
523 B
Dart

class Sport {
late int sportId;
late String name;
late String sportNameTranslation;
Sport.fromJson(Map json) {
this.sportId = json['sportId'];
this.name = json['name'];
this.sportNameTranslation =
json['translations'] != null && (json['translations']).length > 0 ? json['translations'][0]['sportName'] : this.name;
}
Map<String, dynamic> toJson() => {
"sportId": sportId,
"name": name,
};
@override
String toString() {
return this.toJson().toString();
}
}