Robo-advisory-dart/lib/models/transaction.dart

33 lines
721 B
Dart
Raw Permalink Normal View History

class Category {
String name;
String color;
2022-09-11 14:37:28 +00:00
Category({required this.name, required this.color});
Category.formJson(Map<String, dynamic> map)
: name = map["name"],
color = map["color"];
}
class Transaction {
String amount;
String description;
String date;
String name;
Category category;
Transaction(
2022-09-11 14:37:28 +00:00
{required this.amount,
required this.description,
required this.date,
required this.name,
required this.category});
Transaction.fromJson(Map<String, dynamic> map)
: category = Category.formJson(map["category"]),
amount = map["amount"],
description = map["description"],
name = map["name"],
date = map["date"];
}