How can you cut down on the amount of code in your project but still retain all the functionality of your app? This video answers that question by introducing Dart ternary operators and how you can turn whole blocks of code into just a few lines.
all about Dart enums. … And our enums are making our code a lot easier to read. … And it's starting to make a lot more sense. … But there's still so much code for achieving some … functionality that's actually really simple, … we're just toggling our card's color, … why do we need so much code? … In order to reduce the amount of code but still … else-if, else statements to be able to perform … a different behavior depending on what the condition was. … And we talked about it in terms of a rail track … deciding which way to go depending on which … conditions were currently in play. … Now the Dart ternary operator is actually just a bit … of what we call syntatic sugar to make something … that's actually very long and very wordy, … say an if condition is true, then do this, else do this. … And there's a lot of brackets, there's a lot of key words … and there's a lot of lines of code to achieve this. … But if we used a Dart ternary operator instead, … then it simplifies that into a single line …
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