DEV Community

Andrea Bizzotto
Andrea Bizzotto

Posted on • Edited on • Originally published at codewithandrea.com

4 2

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.

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

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\]

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

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

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

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

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

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

Happy coding!

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (2)

Collapse
 
mdev88 profile image
Martín Vukovic

Great series!
I've finished your Dart course on Udemy and I see a lot of the tips here are used and explained in more detail there, 100% recommend.

Collapse
 
jeriel profile image
Jeriel Ng

This series has been really helpful as I've started learning Flutter with my team! Thanks for posting these, and I hope to see more down the line.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay