Dart & Flutter Easy Wins 29-35

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:

29. When EXTENDING classes, all ABSTRACT methods MUST be overridden & other methods CAN be overridden. When IMPLEMENTING classes, ALL methods MUST be overridden.

When EXTENDING classes, all ABSTRACT methods MUST be overridden & other methods CAN be overridden. When IMPLEMENTING classes, ALL methods MUST be overridden.
When EXTENDING classes, all ABSTRACT methods MUST be overridden & other methods CAN be overridden. When IMPLEMENTING classes, ALL methods MUST be overridden.

30. Need to iterate through a map in a null-safe manner? Use `.entries`:

Need to iterate through a map in a null-safe manner? Use .entries
Need to iterate through a map in a null-safe manner? Use .entries

31. Need different implementations for web and native platforms? Use conditional imports.

More info here: Conditionally importing and exporting library files

Need different implementations for web and native platforms? Use conditional imports.
Need different implementations for web and native platforms? Use conditional imports.

32. Need to declare a function type with generics? Use a typedef:

Need to declare a function type with generics? Use a typedef
Need to declare a function type with generics? Use a typedef

33. Need to work with *computed* variables? Use getters and setters.

Need to work with *computed* variables? Use getters and setters
Need to work with *computed* variables? Use getters and setters

34. Need to return a Future that returns immediately? Use `Future.value`.

Need to return a Future that returns immediately? Use Future.value
Need to return a Future that returns immediately? Use Future.value

35. Want to force a delay before executing some code? Use `Future.delayed`.

Want to force a delay before executing some code? Use Future.delayed
Want to force a delay before executing some code? Use Future.delayed

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

Happy coding!

Want More?

Invest in yourself with my high-quality Flutter courses.

Flutter Foundations Course

Flutter Foundations Course

Learn about State Management, App Architecture, Navigation, Testing, and much more by building a Flutter eCommerce app on iOS, Android, and web.

Flutter & Firebase Masterclass

Flutter & Firebase Masterclass

Learn about Firebase Auth, Cloud Firestore, Cloud Functions, Stripe payments, and much more by building a full-stack eCommerce app with Flutter & Firebase.

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

Flutter Animations Masterclass

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