25 lines
628 B
Dart
25 lines
628 B
Dart
import '/models/recurring_tracked_type.dart';
|
|
import '/models/frequency.dart';
|
|
|
|
class Expense extends RecurringTrackedType {
|
|
static String amountText = "Cost";
|
|
|
|
Expense({
|
|
super.id,
|
|
required super.name,
|
|
required super.amount,
|
|
required super.frequency,
|
|
required super.description,
|
|
});
|
|
|
|
factory Expense.fromMap(Map<String, dynamic> json) => Expense(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
amount: json['cost'],
|
|
frequency: Frequency.values
|
|
.where((freq) => freq.title == json['frequency'])
|
|
.first,
|
|
description: json['description'],
|
|
);
|
|
}
|