So far the code you've seen is practical but clunky. This video introduces the functionality of enumeration, or dart enums, and how you can use them to clarify your code and streamline your app.
we learned about the GestureDetector, … and we added it as a parent to our reusable card at the top, … the ones with our male and female icons. … And we created a method called updateColor … that allow us to select one of these genders … and to be able to activate … these cards by changing their color. … Now, at the moment our code works just fine, … So, we're saying that one is going to equal male … and two is going to equal female. … So, that's why we're checking to see … if the gender is one … then that means the male card got pressed, … but if the gender was two … then that means the female card got pressed. … Now, as you can imagine … if you came back to this code in six months time … or if somebody else was looking at it … they might get a little bit confused … because it doesn't make a lot of sense. … And even though we have a lot of comments here … it's not great, so, how can we solve this? … In this lesson we're going to address … all of this by learning a concept in programming …
This course was created by London App Brewery. We are pleased to host this content in our library.
- Using Flutter themes
- Refactoring widgets
- Customizing widgets using themes
- Routes and navigating
- Dart maps