DEV Community

Andrea Bizzotto
Andrea Bizzotto

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

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!

Top comments (0)