BACK TO TEMPLATES
rulesany

Flutter App Rules

AGENTS.md template for Flutter and Dart codebases covering BLoC/Riverpod state management, widget trees, and flutter analyze.

When to use this

Place this file at the root of a Flutter application to establish Dart formatting rules, state management standards, and static analysis guidelines.

The template

# AGENTS.md

## Project Context

Flutter cross-platform mobile application using Dart, Riverpod for state management, and GoRouter.

## Commands

- `flutter run` start application on connected device/emulator
- `flutter test` execute Flutter widget and unit tests
- `flutter analyze` run Dart static analyzer

Always ensure `flutter analyze` passes with zero warnings before declaring a task complete.

## Conventions

- Prefer `const` constructors for immutable widgets to prevent unnecessary rebuilds.
- Keep widget `build()` methods pure and free of side effects.
- Separate business logic into Riverpod Providers or BLoC classes under `lib/features/`.
- Format Dart code strictly using `dart format .`.

## Restrictions

- Do not use `setState()` inside shared feature screens; use Riverpod reactive state.
- Do not make direct HTTP requests inside Widget build methods.

## Approval Required

- Adding new `pubspec.yaml` package dependencies.
- Modifying native iOS/Android build configurations (`Podfile`, `build.gradle`).

Customization Guide

Switch Riverpod to BLoC or Provider depending on your app's state management architecture.

Last verified 2026-07-26