For loops and for in loops can both be used to quickly and easily create lists and menus in your apps. This video shows how to use both kinds of loops to add a functioning drop-down menu to the sample project.
- [Instructor] In this lesson, I'm going to show you … a sample solution for creating all our dropdown menu items … in one go by using loops. … Either you've used what you've already known … about for loops, or you've watched the last lesson … and you've now learned all about Dart for loops, … but either way, we're going to solve this challenge … of taking our list of currencies, … and converting them into dropdown menu items … with text widgets with value properties. … We're going to insert the value … of each of those items inside our currenciesList … into one of these widgets. … Right up here, I'm going to create a new method … and I'm going to call it getDropdownItems, … and it's going to have no inputs, … but it's going to carry out some functionality. … Now mind you, your particular implementation might differ … from the sample solution that I'm providing … and that's okay. … Your code and my code doesn't have to match one to one. … If your code works, it works and that's what counts. …
This course was created by London App Brewery. We are pleased to host this content in our library.