first commit structure of app
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
class KaufFilamentModel {
|
||||
final String filamentId;
|
||||
final DateTime kaufdatum;
|
||||
final String haendler;
|
||||
final String marke;
|
||||
final String material;
|
||||
final double preis;
|
||||
final String farbe;
|
||||
final String gewicht;
|
||||
|
||||
const KaufFilamentModel({
|
||||
required this.filamentId,
|
||||
required this.kaufdatum,
|
||||
required this.haendler,
|
||||
required this.marke,
|
||||
required this.material,
|
||||
required this.preis,
|
||||
required this.farbe,
|
||||
required this.gewicht,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'filamentId': filamentId,
|
||||
'kaufdatum': kaufdatum.toIso8601String(),
|
||||
'haendler': haendler,
|
||||
'marke': marke,
|
||||
'material': material,
|
||||
'preis': preis,
|
||||
'farbe': farbe,
|
||||
'gewicht': gewicht,
|
||||
};
|
||||
|
||||
factory KaufFilamentModel.fromJson(Map<String, dynamic> json) {
|
||||
return KaufFilamentModel(
|
||||
filamentId: json['filamentId'] as String,
|
||||
kaufdatum: DateTime.parse(json['kaufdatum'] as String),
|
||||
haendler: json['haendler'] as String,
|
||||
marke: json['marke'] ?? '',
|
||||
material: json['material'] as String,
|
||||
preis: (json['preis'] as num).toDouble(),
|
||||
farbe: json['farbe'] as String,
|
||||
gewicht: json['gewicht'] ?? '1000'
|
||||
);
|
||||
}
|
||||
|
||||
KaufFilamentModel copyWith({
|
||||
String? filamentId,
|
||||
DateTime? kaufdatum,
|
||||
String? haendler,
|
||||
String? marke,
|
||||
String? material,
|
||||
double? preis,
|
||||
String? farbe,
|
||||
String? gewicht,
|
||||
}) {
|
||||
return KaufFilamentModel(
|
||||
filamentId: filamentId ?? this.filamentId,
|
||||
kaufdatum: kaufdatum ?? this.kaufdatum,
|
||||
haendler: haendler ?? this.haendler,
|
||||
marke: marke ?? this.marke,
|
||||
material: material ?? this.material,
|
||||
preis: preis ?? this.preis,
|
||||
farbe: farbe ?? this.farbe,
|
||||
gewicht: gewicht ?? this.gewicht
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user