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'm sharing 7 tips every week here on my website.

Entire series here:

Without further ado, here are the first 7 tips.

1. Prefer const over final over var

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
Use type annotations for safer code

3. Use underscores for unused function arguments

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.
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
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
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.
You can catch and handle exceptions by type with multiple `on` clauses.

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.