Refactor ForexRateAPI integration to load API key from .env file and enhance error handling

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-19 23:48:26 +01:00
parent a775a20dd2
commit e6c16967f9
8 changed files with 244 additions and 81 deletions
+11
View File
@@ -21,6 +21,7 @@ class HomeScreen extends StatelessWidget {
symbol: 'SEK ',
decimalDigits: 2,
);
final rateFormat = NumberFormat('0.000000');
final totalUsd = rows.isEmpty ? 0.0 : rows.last.runningUsd;
final totalSek = rows.isEmpty ? 0.0 : rows.last.runningSek;
@@ -80,6 +81,7 @@ class HomeScreen extends StatelessWidget {
DataColumn(label: Text('Status')),
DataColumn(label: Text('USD')),
DataColumn(label: Text('SEK')),
DataColumn(label: Text('Rate USD->SEK')),
DataColumn(label: Text('Running USD')),
DataColumn(label: Text('Running SEK')),
],
@@ -110,6 +112,15 @@ class HomeScreen extends StatelessWidget {
: sekCurrency.format(row.sekAmount),
),
),
DataCell(
Text(
row.effectiveUsdToSekRate == null
? '-'
: rateFormat.format(
row.effectiveUsdToSekRate,
),
),
),
DataCell(
Text(usdCurrency.format(row.runningUsd)),
),