add some new features
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
class AbfallModel {
|
||||
const AbfallModel({
|
||||
required this.abfallId,
|
||||
required this.datumZeit,
|
||||
required this.gewichtGramm,
|
||||
required this.kosten,
|
||||
this.bauteilId,
|
||||
this.bauteilName,
|
||||
this.kostenUnbekannt = false,
|
||||
this.kostenNachtraeglich = false,
|
||||
});
|
||||
|
||||
final String abfallId;
|
||||
final DateTime datumZeit;
|
||||
final double gewichtGramm;
|
||||
final double kosten;
|
||||
|
||||
// Linked records are derived from parts, never stored a second time.
|
||||
final String? bauteilId;
|
||||
final String? bauteilName;
|
||||
final bool kostenUnbekannt;
|
||||
final bool kostenNachtraeglich;
|
||||
bool get ausBauteil => bauteilId != null;
|
||||
|
||||
factory AbfallModel.fromJson(Map<String, dynamic> json) => AbfallModel(
|
||||
abfallId: json['abfallId'] as String,
|
||||
datumZeit: DateTime.parse(json['datumZeit'] as String).toLocal(),
|
||||
gewichtGramm: (json['gewichtGramm'] as num).toDouble(),
|
||||
kosten: (json['kosten'] as num).toDouble(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'abfallId': abfallId,
|
||||
'datumZeit': datumZeit.toIso8601String(),
|
||||
'gewichtGramm': gewichtGramm,
|
||||
'kosten': kosten,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user