import '../../internal/application/Standing.dart'; class StandingChange { String? id; Standing from; Standing to; DateTime? at; String trigger; StandingChange({ this.id, this.from = Standing.Good, this.to = Standing.Good, this.at, this.trigger = "", }); factory StandingChange.fromJson(Map json) { return StandingChange( id: json['id'], from: getStanding(json['from']), to: getStanding(json['to']), at: DateTime.tryParse(json['at'] ?? ""), trigger: json['trigger'] ?? "", ); } Map toJson() { final Map data = {}; data['id'] = id; data['from'] = from.name; data['to'] = to.name; data['at'] = at?.toIso8601String(); data['trigger'] = trigger; return data; } }