Best Practices
Code Style
Naming Conventions
Use Type Annotations
Prefer final over var
Null Safety
Functions
Keep Functions Small
Use Named Parameters
Collections
Use Collection Literals
Use Collection If/For
Classes
Use Initializing Formals
Prefer Composition Over Inheritance
Async Programming
Always Use async/await
Handle Errors
Performance
Use const Constructors
Avoid Unnecessary Rebuilds
Documentation
Document Public APIs
Testing
Write Tests
Summary
- Follow naming conventions
- Use type annotations for clarity
- Embrace null safety
- Keep functions small and focused
- Use named parameters for clarity
- Prefer
constandfinal - Handle errors properly
- Document public APIs
- Write tests
- Use linter (analysis_options.yaml)