add currency object
This commit is contained in:
parent
d02877b287
commit
4581480f2e
1 changed files with 23 additions and 0 deletions
23
Frontend/lib/mih_components/mih_objects/currency.dart
Normal file
23
Frontend/lib/mih_components/mih_objects/currency.dart
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
class Currency {
|
||||
final String code;
|
||||
final String name;
|
||||
|
||||
const Currency({
|
||||
required this.code,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
factory Currency.fromJson(Map<String, dynamic> json) {
|
||||
return switch (json) {
|
||||
{
|
||||
"code": String code,
|
||||
'name': String name,
|
||||
} =>
|
||||
Currency(
|
||||
code: code,
|
||||
name: name,
|
||||
),
|
||||
_ => throw const FormatException('Failed to load Currency object.'),
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue