DEV Community

Andrea Bizzotto
Andrea Bizzotto

Posted on β€’ Edited on β€’ Originally published at codewithandrea.com

9 4

Dart & Flutter Easy Wins 1-7

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'll be sharing 7 tips every week here.

Without further ado, here are the first 7 tips.

1. Prefer const over final over var

Prefer const over final over var

2. Use type annotations for safer code

Use type annotations for safer code

3. Use underscores for unused function arguments

Use underscores for unused function arguments

4. Functions are first class citizens in Dart, and they can be passed directly as arguments

Functions are first class citizens in Dart, and they can be passed directly as arguments.

5. You can use collection-if and spreads with lists, sets AND maps

You can use collection-if and spreads with lists, sets AND maps

6. Use the cascade operator to modify mutable variables

Use the cascade operator to modify mutable variables

7. You can catch and handle exceptions by type with multiple on clauses

You can catch and handle exceptions by type with multiple `on` clauses.

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

Happy coding!

Sentry growth stunted Image

If you are wasting time trying to track down the cause of a crash, it’s time for a better solution. Get your crash rates to zero (or close to zero as possible) with less time and effort.

Try Sentry for more visibility into crashes, better workflow tools, and customizable alerts and reporting.

Switch Tools πŸ”

Top comments (0)

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