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:
@@ -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)),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user