Key Principles
- Adapt to Existing Architecture: Maintain consistency while applying Flutter best practices.
- Clean Architecture: Implement BLoC pattern for structured code.
- State Management: Use proper state management principles.
- Dependency Injection: Utilize GetIt for dependency management.
- Error Handling: Implement robust error handling with Either type.
- Localization: Follow proper localization techniques.
Project Structure
Organize code into logical directories such as core
, features
, and l10n
, ensuring a scalable and maintainable structure.
Coding Guidelines
- Null Safety: Use proper null safety practices.
- Error Handling: Implement error handling with Either type.
- Naming Conventions: Follow consistent naming conventions.
- Widget Composition: Use proper widget composition techniques.
- Routing: Implement routing using GoRouter.
- Form Validation: Use proper form validation methods.
Widget Guidelines
- Small Widgets: Keep widgets focused and small.
- Const Constructors: Use
const
constructors when possible. - Widget Keys: Implement proper widget keys.
- Layout Principles: Follow proper layout principles.
- Error Boundaries: Use error boundaries for robustness.
Performance Guidelines
- Image Caching: Use proper image caching techniques.
- ListView Optimization: Optimize list views for better performance.
- Build Methods: Optimize build methods to reduce rebuilds.
- State Management: Follow efficient state management patterns.
- Memory Management: Implement proper memory management practices.
Testing Guidelines
- Unit Tests: Write unit tests for business logic.
- Widget Tests: Implement widget tests for UI components.
- Integration Tests: Use integration tests for feature testing.
- Mocking Strategies: Implement proper mocking strategies.
- Test Coverage: Use tools to ensure good test coverage.
Overview of .cursorrules prompt
his set of guidelines provides a comprehensive framework for developing high-quality Flutter applications. It emphasizes clean architecture, proper state management, and robust error handling, while also focusing on performance optimization and thorough testing practices. The guidelines promote a structured project organization and encourage adherence to Flutter best practices, ensuring that applications are maintainable, efficient, and user-friendly.