first commit
This commit is contained in:
commit
e630f2a3ec
80 changed files with 3889 additions and 0 deletions
39
lib/models/fuel_entry.dart
Normal file
39
lib/models/fuel_entry.dart
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
class FuelEntry {
|
||||
final String id;
|
||||
final String vehicleId;
|
||||
final DateTime date;
|
||||
final double gallons;
|
||||
final double pricePerGallon;
|
||||
final double totalCost;
|
||||
final String? receiptImagePath;
|
||||
|
||||
FuelEntry({
|
||||
required this.id,
|
||||
required this.vehicleId,
|
||||
required this.date,
|
||||
required this.gallons,
|
||||
required this.pricePerGallon,
|
||||
required this.totalCost,
|
||||
this.receiptImagePath,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'vehicleId': vehicleId,
|
||||
'date': date.toIso8601String(),
|
||||
'gallons': gallons,
|
||||
'pricePerGallon': pricePerGallon,
|
||||
'totalCost': totalCost,
|
||||
'receiptImagePath': receiptImagePath,
|
||||
};
|
||||
|
||||
factory FuelEntry.fromJson(Map<String, dynamic> json) => FuelEntry(
|
||||
id: json['id'] as String,
|
||||
vehicleId: json['vehicleId'] as String,
|
||||
date: DateTime.parse(json['date'] as String),
|
||||
gallons: (json['gallons'] as num).toDouble(),
|
||||
pricePerGallon: (json['pricePerGallon'] as num).toDouble(),
|
||||
totalCost: (json['totalCost'] as num).toDouble(),
|
||||
receiptImagePath: json['receiptImagePath'] as String?,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue