Skip to content

Latest commit

History

History
19 lines (12 loc) 路 702 Bytes

File metadata and controls

19 lines (12 loc) 路 702 Bytes

Prefer const over final over var

When declaring variables in Dart, prefer const over final over var:

  • const is for hardcoded, compile-time constants
  • final is for read-only variables that are set just once
  • var is for variables that are set more than once

The static analyzer will help you choose wisely. 馃檪


Found this useful? Show some love and share the original tweet 馃檹

Previous Next
Flutter app localization in 5 min Use type annotations for safer code