PluginBench
Rule

flutter development guidelines

via PatrickJS/awesome-cursorrules

Flutter development with MVVM, Riverpod state management, and Material Design.

What is flutter development guidelines?

Enforces Flutter best practices including MVVM architecture, Riverpod for state management, Material widgets, and Dart style conventions. Use this rule to maintain consistent code structure, naming conventions, and performance optimization across a Flutter project.

  • Organizes code into MVVM layers: models, viewmodels, views/screens, services, and utilities
  • Enforces Dart naming conventions: snakeCase for files/directories, UpperCamelCase for classes, lowerCamelCase for variables and methods
  • Structures imports in order: dart: packages, third-party packages, then relative project imports
  • Applies Material Design widgets with unified ThemeData for consistent styling
  • Optimizes performance using StatelessWidget, const constructors, and Riverpod state management
  • Enforces code style rules: 80-character line limit, braces for all control flow, single quotes, and proactive commenting

Applies to

File patterns this rule matches.

**/*.dart
Rule definition (reference)

Source of truth, from the repository.

Code style and structure

  • Write concise and efficient source code.
  • Strive for source code that is easy to read and maintain, and provide accurate examples.
  • Avoid duplication of code: modularise widgets and functions into reusable components.
  • Use descriptive variable names: use names with auxiliary verbs such as isLoading, hasError.

Directory structure under /lib.

  • /lib/models/: data models and type definitions (Models)
  • /lib/viewmodels/: state management and business logic (ViewModel)
  • /lib/views/widgets/: reusable widgets (View)
  • /lib/views/screens/: per-screen widgets (View)
  • /lib/services/: service classes for API calls and data access
  • /lib/utils/: helper functions and constants

Naming conventions

  • Directories and files: use snakeCase (e.g. auth_wizard.dart).
  • UpperCamelCase: use for class names/enumerations/typedefs/type parameters, etc.
  • LowerCamelCase: used for variables/functions/class members (properties, methods), etc.
  • lowercase_with_underscores (snakeCase): for files/directories/packages/libraries, etc.

Import.

  • Place imports starting with dart: first (use lowercase_with_underscores for the import prefix).
  • Next, import third-party packages (package:).
  • Finally, import relative paths and files in the project.

Using Dart.

  • Take advantage of type safety: use static typing in all code and utilise type inference wherever possible.

UI and styling.

  • Use Material widgets.
  • Unify theming: use ThemeData to apply consistent styles.

Performance optimisation.

  • Prefer StatelessWidget when state is not required.
  • Make use of const constructors: if widgets are immutable, use const to optimise builds.

State management.

  • Use riverpod to implement efficient state management.
  • Manage state within the ViewModel and link it to the View.

Software architecture

Use MVVM (Model View ViewModel).

Key rules.

  • To improve code readability, lines should not exceed 80 characters in length.
  • Use braces {} for all flow control structures (if, for, while, etc.).
  • Use comment-outs proactively to help understand and maintain code.
  • Use single quotes, avoid the use of double quotes and use consistent string literals to improve readability.

Related rules

Senior full-stack TypeScript, React, Node.js guidance with clean architecture, testing, and WHY-oriented reasoning.

**/*
41k
via PatrickJS/awesome-cursorrules

Quantitative factor research skills for designing, evaluating, and mining alpha factors in equities markets.

**/*
41k
via PatrickJS/awesome-cursorrules

Android development with Jetpack Compose, clean architecture, and Material Design 3.

**/*
41k
via PatrickJS/awesome-cursorrules

Angular development with Novo Elements UI library using standalone components.

**/*
41k
via PatrickJS/awesome-cursorrules

Expert Angular 18 + TypeScript development with Jest, emphasizing clean code and performance.

**/*
41k
via PatrickJS/awesome-cursorrules

Manage Kubernetes clusters, add-ons, stacks, and credentials via the Ankra CLI platform.

**/*.sh +5
41k
via PatrickJS/awesome-cursorrules