mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-28 06:28:41 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
33 lines
761 B
Dart
33 lines
761 B
Dart
class Account {
|
|
Account({
|
|
required this.id,
|
|
required this.label,
|
|
String? balance,
|
|
}) : balance = balance ?? "0.00";
|
|
|
|
Account.fromMap(Map<String, Object?> map)
|
|
: id = map["id"] is int ? map["id"] as int : int.tryParse(map["id"]?.toString() ?? "") ?? 0,
|
|
label = (map["label"] ?? "") as String,
|
|
balance = (map["balance"] ?? "0.00") as String;
|
|
|
|
final int id;
|
|
final String label;
|
|
final String balance;
|
|
|
|
Account copyWith({
|
|
int? id,
|
|
String? label,
|
|
String? balance,
|
|
}) => Account(
|
|
id: id ?? this.id,
|
|
label: label ?? this.label,
|
|
balance: balance ?? this.balance,
|
|
);
|
|
|
|
Map<String, Object> toMap() => {
|
|
"id": id.toString(),
|
|
"label": label,
|
|
"balance": balance,
|
|
};
|
|
}
|