From 4581480f2e67fee49585ad434111511cec5ea83a Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 11 Jun 2025 16:46:33 +0200 Subject: [PATCH] add currency object --- .../mih_components/mih_objects/currency.dart | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Frontend/lib/mih_components/mih_objects/currency.dart 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.'), + }; + } +}