Skip to content

Commit

Permalink
Code simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
ferraridamiano committed Feb 10, 2024
1 parent 2f55ae8 commit fdbf88a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/models/currencies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,8 @@ final currenciesProvider = FutureProvider<Currencies>((ref) async {
/// Updates the currencies exchange rates with the latest values. It will also
/// update the status at the end (updated or error)
Future<Currencies> downloadCurrencies() async {
// stringRequest prepares the string request for all the currencies
String stringRequest = '';
for (String currency in Currencies().exchangeRates.keys) {
if (currency != 'EUR') {
stringRequest += '$currency+';
}
}
// removes the last '+'
stringRequest = stringRequest.substring(0, stringRequest.length - 1);
final stringRequest =
Currencies.defaultExchangeRates.keys.where((e) => e != 'EUR').join('+');
try {
var response = await http.get(
Uri.https(
Expand Down

0 comments on commit fdbf88a

Please sign in to comment.