dev
dart 23 lines 617 Bytes
Raw
1 import 'package:cw_core/amount/money.dart';
2
3 abstract class Currency {
4 String get symbol;
5 String get name;
6 String? get fullName;
7 String? get iconPath;
8 int get decimals;
9 String? get tag;
10
11 /// Parse the [value] and turn it into [Money]
12 Money parseAmount(String value);
13
14 /// Try parsing the [value] and turn it into [Money]
15 Money? tryParseAmount(String value);
16
17 @override
18 bool operator ==(Object other) =>
19 other is Currency && other.decimals == decimals && other.symbol == symbol && other.tag == tag;
20
21 @override
22 int get hashCode => decimals.hashCode ^ symbol.hashCode ^ tag.hashCode;
23 }