You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
7 months ago
|
class Value {
|
||
|
final int? id;
|
||
|
final int counterId;
|
||
|
final DateTime date;
|
||
|
final int rate1Id;
|
||
|
final double value1;
|
||
|
final int? rate2Id;
|
||
|
final double? value2;
|
||
|
final int? rate3Id;
|
||
|
final double? value3;
|
||
|
|
||
|
Value(
|
||
|
{this.id,
|
||
|
required this.counterId,
|
||
|
required this.date,
|
||
|
required this.rate1Id,
|
||
|
required this.value1,
|
||
|
this.rate2Id,
|
||
|
this.value2,
|
||
|
this.rate3Id,
|
||
|
this.value3});
|
||
|
|
||
|
factory Value.fromMap(Map<String, dynamic> json) => Value(
|
||
|
id: json["id"],
|
||
|
counterId: json["counter_id"],
|
||
|
date: DateTime.fromMicrosecondsSinceEpoch(json["date"], isUtc: true),
|
||
|
rate1Id: json["rate1_id"],
|
||
|
value1: json["value1"],
|
||
|
rate2Id: json["rate2_id"],
|
||
|
value2: json["value2"],
|
||
|
rate3Id: json["rate3_id"],
|
||
|
value3: json["value3"]);
|
||
|
|
||
|
Map<String, dynamic> toMap() => {
|
||
|
"id": id,
|
||
|
"counter_id": counterId,
|
||
|
"date": date.microsecondsSinceEpoch,
|
||
|
"rate1_id": rate1Id,
|
||
|
"value1": value1,
|
||
|
"rate2_id": rate2Id,
|
||
|
"value2": value2,
|
||
|
"rate3_id": rate3Id,
|
||
|
"value3": value3
|
||
|
};
|
||
|
}
|