Flutter Development Guide
A practical guide for building cross-platform applications with Flutter 3 and Dart. Focuses on proven patterns, state management, and performance optimization.
Quick Reference
Widget Patterns
| Purpose |
Component |
| State management (simple) |
StateProvider + ConsumerWidget |
| State management (complex) |
NotifierProvider / Bloc |
| Async data |
FutureProvider / AsyncNotifierProvider |
| Real-time streams |
StreamProvider |
| Navigation |
GoRouter + context.go/push |
| Responsive layout |
LayoutBuilder + breakpoints |
| List display |
ListView.builder |
| Complex scrolling |
CustomScrollView + Slivers |
| Hooks |
HookWidget + useState/useEffect |
| Forms |
Form + TextFormField + validation |
Performance Patterns
| Purpose |
Solution |
| Prevent rebuilds |
const constructors |
| Selective updates |
ref.watch(provider.select(...)) |
| Isolate repaints |
RepaintBoundary |
| Lazy lists |
ListView.builder |
| Heavy computation |
compute() isolate |
| Image caching |
cached_network_image |
Core Principles
Widget Optimization
- Use
const constructors wherever possible
- Extract static widgets to separate const classes
- Use
Key for list items (ValueKey, ObjectKey)
- Prefer
ConsumerWidget over StatefulWidget for state
State Management
- Riverpod for dependency injection and simple state
- Bloc/Cubit for event-driven workflows and complex logic
- Never mutate state directly (create new instances)
- Use
select() to minimize rebuilds
Layout
- 8pt spacing increments (8, 16, 24, 32, 48)
- Responsive breakpoints: mobile (<650), tablet (650-1100), desktop (>1100)
- Support all screen sizes with flexible layouts
- Follow Material 3 / Cupertino design guidelines
Performance
- Profile with DevTools before optimizing
- Target <16ms frame time for 60fps
- Use
RepaintBoundary for complex animations
- Offload heavy work with
compute()
Checklist
Widget Best Practices
State Management
Navigation
Performance
Testing
References
| Topic |
Reference |
| Widget patterns, const optimization, responsive layout |
Widget Patterns |
| Riverpod providers, notifiers, async state |
Riverpod State Management |
| Bloc, Cubit, event-driven state |
Bloc State Management |
| GoRouter setup, routes, deep linking |
GoRouter Navigation |
| Feature-based structure, dependencies |
Project Structure |
| Profiling, const optimization, DevTools |
Performance Optimization |
| Widget tests, integration tests, mocking |
Testing Strategies |
| iOS/Android/Web specific implementations |
Platform Integration |
| Implicit/explicit animations, Hero, transitions |
Animations |
| Dio, interceptors, error handling, caching |
Networking |
| Form validation, FormField, input formatters |
Forms |
| i18n, flutter_localizations, intl |
Localization |
Flutter, Dart, Material Design, and Cupertino are trademarks of Google LLC and Apple Inc. respectively. Riverpod, Bloc, and GoRouter are open-source packages by their respective maintainers.
Source: MiniMax-AI/skills → skills/flutter-dev/SKILL.md
1---2name: flutter-dev3description: | Flutter cross-platform development guide covering widget patterns, Riverpod/Bloc state management, GoRouter navigation, performance optimization, and platform-specific implementations. Includes const optimization, responsive layouts, testing strategies, and DevTools profiling. Use when: building Flutter apps, implementing state management (Riverpod/Bloc), setting up GoRouter navigation, creating custom widgets, optimizing performance, writing widget tests, cross-platform development.4---5
6
7# Flutter Development Guide
8
9A practical guide for building cross-platform applications with Flutter 3 and Dart. Focuses on proven patterns, state management, and performance optimization.
10
11## Quick Reference
12
13### Widget Patterns
14
15| Purpose | Component |
16|---------|-----------|
17| State management (simple) | `StateProvider` + `ConsumerWidget` |
18| State management (complex) | `NotifierProvider` / `Bloc` |
19| Async data | `FutureProvider` / `AsyncNotifierProvider` |
20| Real-time streams | `StreamProvider` |
21| Navigation | `GoRouter` + `context.go/push` |
22| Responsive layout | `LayoutBuilder` + breakpoints |
23| List display | `ListView.builder` |
24| Complex scrolling | `CustomScrollView` + Slivers |
25| Hooks | `HookWidget` + `useState/useEffect` |
26| Forms | `Form` + `TextFormField` + validation |
27
28### Performance Patterns
29
30| Purpose | Solution |
31|---------|----------|
32| Prevent rebuilds | `const` constructors |
33| Selective updates | `ref.watch(provider.select(...))` |
34| Isolate repaints | `RepaintBoundary` |
35| Lazy lists | `ListView.builder` |
36| Heavy computation | `compute()` isolate |
37| Image caching | `cached_network_image` |
38
39## Core Principles
40
41### Widget Optimization
42- Use `const` constructors wherever possible
43- Extract static widgets to separate const classes
44- Use `Key` for list items (ValueKey, ObjectKey)
45- Prefer `ConsumerWidget` over `StatefulWidget` for state
46
47### State Management
48- Riverpod for dependency injection and simple state
49- Bloc/Cubit for event-driven workflows and complex logic
50- Never mutate state directly (create new instances)
51- Use `select()` to minimize rebuilds
52
53### Layout
54- 8pt spacing increments (8, 16, 24, 32, 48)
55- Responsive breakpoints: mobile (<650), tablet (650-1100), desktop (>1100)
56- Support all screen sizes with flexible layouts
57- Follow Material 3 / Cupertino design guidelines
58
59### Performance
60- Profile with DevTools before optimizing
61- Target <16ms frame time for 60fps
62- Use `RepaintBoundary` for complex animations
63- Offload heavy work with `compute()`
64
65## Checklist
66
67### Widget Best Practices
68- [ ] `const` constructors on all static widgets
69- [ ] Proper `Key` on list items
70- [ ] `ConsumerWidget` for state-dependent widgets
71- [ ] No widget building inside `build()` method
72- [ ] Extract reusable widgets to separate files
73
74### State Management
75- [ ] Immutable state objects
76- [ ] `select()` for granular rebuilds
77- [ ] Proper provider scoping
78- [ ] Dispose controllers and subscriptions
79- [ ] Handle loading/error states
80
81### Navigation
82- [ ] GoRouter with typed routes
83- [ ] Auth guards via redirect
84- [ ] Deep linking support
85- [ ] State preservation across routes
86
87### Performance
88- [ ] Profile mode testing (`flutter run --profile`)
89- [ ] <16ms frame rendering time
90- [ ] No unnecessary rebuilds (DevTools check)
91- [ ] Images cached and resized
92- [ ] Heavy computation in isolates
93
94### Testing
95- [ ] Widget tests for UI components
96- [ ] Unit tests for business logic
97- [ ] Integration tests for user flows
98- [ ] Bloc tests with `blocTest()`
99
100## References
101
102| Topic | Reference |
103|-------|-----------|
104| Widget patterns, const optimization, responsive layout | [Widget Patterns](references/widget-patterns.md) |
105| Riverpod providers, notifiers, async state | [Riverpod State Management](references/riverpod-state.md) |
106| Bloc, Cubit, event-driven state | [Bloc State Management](references/bloc-state.md) |
107| GoRouter setup, routes, deep linking | [GoRouter Navigation](references/gorouter-navigation.md) |
108| Feature-based structure, dependencies | [Project Structure](references/project-structure.md) |
109| Profiling, const optimization, DevTools | [Performance Optimization](references/performance.md) |
110| Widget tests, integration tests, mocking | [Testing Strategies](references/testing.md) |
111| iOS/Android/Web specific implementations | [Platform Integration](references/platform-specific.md) |
112| Implicit/explicit animations, Hero, transitions | [Animations](references/animations.md) |
113| Dio, interceptors, error handling, caching | [Networking](references/networking.md) |
114| Form validation, FormField, input formatters | [Forms](references/forms.md) |
115| i18n, flutter_localizations, intl | [Localization](references/localization.md) |
116
117---
118
119Flutter, Dart, Material Design, and Cupertino are trademarks of Google LLC and Apple Inc. respectively. Riverpod, Bloc, and GoRouter are open-source packages by their respective maintainers.
120
121---
122
123**Source:** [`MiniMax-AI/skills`](https://github.com/MiniMax-AI/skills) → `skills/flutter-dev/SKILL.md`