Robo-advisory-dart/lib/models/transaction.dart
2022-09-11 15:39:48 +01:00

33 lines
721 B
Dart

class Category {
String name;
String color;
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(
{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"];
}