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:

36. Use `Timer.periodic` to create a timer that repeats with a given period

Use Timer.periodic to create a timer that repeats with a given period
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\]
Need to convert an enum to an int or viceversa? Use .index and values\[i\]

38. Use asserts to disrupt program execution if a boolean condition is false

Use asserts to disrupt program execution if a boolean condition is false
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

Need a better logger for your apps? Use the logger package
Need a better logger for your apps? Use the logger package

40. Use the Flutter DevTools to inspect and profile your Flutter apps

More info & installation instructions here: Flutter DevTools

Use the Flutter DevTools to inspect and profile your Flutter apps
Use the Flutter DevTools to inspect and profile your Flutter apps

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

Anonymous functions can be assigned to variables, or passed as arguments to other functions
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

Want a function that can only throw? Use Never
Want a function that can only throw? Use Never

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

Happy coding!

Want More?

Invest in yourself with my high-quality Flutter courses.

The Complete Dart Developer Guide

The Complete Dart Developer Guide

Learn Dart Programming in depth. Includes: basic to advanced topics, exercises, and projects. Fully updated to Dart 2.15.

Flutter Animations Masterclass - Full Course

Flutter Animations Masterclass - Full Course

Master Flutter animations and build a completely custom habit tracking application.

Flutter & Firebase Course: Build a Complete App for iOS & Android

Flutter & Firebase Course: Build a Complete App for iOS & Android

A full course with in-depth content, taking you from the basics all the way up to more advanced topics.

Flutter REST API Crash Course

Flutter REST API Crash Course

Build a Coronavirus Tracking App, and learn how to use REST APIs in Flutter.

Get the best Flutter tutorials, right in your inbox.

Join over 16,000 developers who receive my weekly Flutter email course & newsletter:

No spam, ever. Unsubscribe at any time.