Prefer const over final over var¶
When declaring variables in Dart, prefer const over final over var:
constis for hardcoded, compile-time constantsfinalis for read-only variables that are set just oncevaris for variables that are set more than once
The static analyzer will help you choose wisely. 🙂
| Previous | Next |
|---|---|
| Flutter app localization in 5 min | Use type annotations for safer code |
Last update:
18 septembre 2023
Created: 18 septembre 2023
Created: 18 septembre 2023
