Search⌘ K
AI Features

Solution: Currency Converter

Understand how to define a Dart function that converts currency by multiplying input parameters. Learn to call this function, capture its return value, and print the result. This lesson helps you apply core concepts of functions, parameters, return types, and console output in Dart.

We'll cover the following...
Dart
double convertCurrency(double usdAmount, double exchangeRate) {
return usdAmount * exchangeRate;
}
void main() {
final eurAmount = convertCurrency(150.0, 0.92);
print(eurAmount);
}

Solution explanation

In the main.dart file:

    ...