DEV Community

Andrea Bizzotto
Andrea Bizzotto

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

1 1

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.

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.

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

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.

32. 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

34. 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

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

Happy coding!

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

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