Background
While following London App Brewery's Bitcoin Ticker project, and I got stuck trying to create DropdownMenuItem
s via a for-in loop. The warning that the Dart Analysis gave me was Undefined name 'currency'
. Here's the code that produced the error:
Problematic Code
List<DropdownMenuItem<String>> buildCurrencyDropdownMenuItems() {
List<DropdownMenuItem<String>> items = [];
for (currency in currenciesList) {
items.add(DropdownMenuItem(child: Text(currency), value: currency));
}
return items;
}
Question
What does Undefined name 'currency' mean in Dart? Does that really mean it's an undefined variable named 'currency'?