diff --git a/Frontend/lib/mih_components/mih_objects/currency.dart b/Frontend/lib/mih_components/mih_objects/currency.dart new file mode 100644 index 00000000..d87eacf7 --- /dev/null +++ b/Frontend/lib/mih_components/mih_objects/currency.dart @@ -0,0 +1,23 @@ +class Currency { + final String code; + final String name; + + const Currency({ + required this.code, + required this.name, + }); + + factory Currency.fromJson(Map json) { + return switch (json) { + { + "code": String code, + 'name': String name, + } => + Currency( + code: code, + name: name, + ), + _ => throw const FormatException('Failed to load Currency object.'), + }; + } +}