Dart & Flutter Easy Wins 36-42
I recently started a series of daily tweets about easy ways to improve your Dart & Flutter code. I called this Easy Wins.
To make these easier to find, I'm sharing 7 tips every week here on my website.
Entire series here:
- Dart & Flutter Easy Wins 1-7
- Dart & Flutter Easy Wins 8-14
- Dart & Flutter Easy Wins 15-21
- Dart & Flutter Easy Wins 22-28
- Dart & Flutter Easy Wins 29-35
- Dart & Flutter Easy Wins 36-42

Code with Andrea is free for everyone. Help me keep it that way by checking out this sponsor:

Faster mobile builds; faster deliveries with Codemagic CI/CD: Do not waste valuable developer resources, replace manual intervention and build, test and deliver mobile apps 20% faster with CI/CD for mobile.
36. Use `Timer.periodic` to create a timer that repeats with a given period

37. Need to convert an enum to an int or viceversa? Use `.index` and `values[i]`
![Need to convert an enum to an int or viceversa? Use .index and values[i]](images/037.enum-index-values.png)
38. Use asserts to disrupt program execution if a boolean condition is false

39. Need a better logger for your apps? Use the logger package
Link: Logger package

40. Use the Flutter DevTools to inspect and profile your Flutter apps
More info & installation instructions here: Flutter DevTools

41. Anonymous functions can be assigned to variables, or passed as arguments to other functions

42. Want a function that can only throw? Use Never
More info here: Never for unreachable code

More tips coming next week. Subscribe via RSS for updates!
Happy coding!