{"slug":"flutter-dart-code-review","title":"flutter-dart-code-review","summary":"Library-agnostic Flutter/Dart code review checklist covering widget best practices, state management patterns (BLoC, Riverpod, Provider, GetX, MobX, Signals), Dart idioms, performance, accessibility, security, and clean architecture. Use when reviewing Flutter or Dart code, whate","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-12-02T16:53:39.132209Z","repo":{"url":"https://github.com/beginwithu/agent-skills","stars":11,"forks":2,"license":"MIT","updatedAt":"2026-12-02T16:37:11Z"},"bodyHtml":"<hr>\n<h2>name: flutter-dart-code-review\ndescription: Library-agnostic Flutter/Dart code review checklist covering widget best practices, state management patterns (BLoC, Riverpod, Provider, GetX, MobX, Signals), Dart idioms, performance, accessibility, security, and clean architecture. Use when reviewing Flutter or Dart code, whatever state management library the project uses.\nmetadata:\norigin: ECC</h2>\n<h1>Flutter/Dart Code Review Best Practices</h1>\n<p>Comprehensive, library-agnostic checklist for reviewing Flutter/Dart applications. These principles apply regardless of which state management solution, routing library, or DI framework is used.</p>\n<hr>\n<h2>1. General Project Health</h2>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Project follows consistent folder structure (feature-first or layer-first)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Proper separation of concerns: UI, business logic, data layers</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No business logic in widgets; widgets are purely presentational</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>pubspec.yaml</code> is clean — no unused dependencies, versions pinned appropriately</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>analysis_options.yaml</code> includes a strict lint set with strict analyzer settings enabled</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No <code>print()</code> statements in production code — use <code>dart:developer</code> <code>log()</code> or a logging package</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Generated files (<code>.g.dart</code>, <code>.freezed.dart</code>, <code>.gr.dart</code>) are up-to-date or in <code>.gitignore</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Platform-specific code isolated behind abstractions</li>\n</ul>\n<hr>\n<h2>2. Dart Language Pitfalls</h2>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Implicit dynamic</strong>: Missing type annotations leading to <code>dynamic</code> — enable <code>strict-casts</code>, <code>strict-inference</code>, <code>strict-raw-types</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Null safety misuse</strong>: Excessive <code>!</code> (bang operator) instead of proper null checks or Dart 3 pattern matching (<code>if (value case var v?)</code>)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Type promotion failures</strong>: Using <code>this.field</code> where local variable promotion would work</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Catching too broadly</strong>: <code>catch (e)</code> without <code>on</code> clause; always specify exception types</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Catching <code>Error</code></strong>: <code>Error</code> subtypes indicate bugs and should not be caught</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Unused <code>async</code></strong>: Functions marked <code>async</code> that never <code>await</code> — unnecessary overhead</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong><code>late</code> overuse</strong>: <code>late</code> used where nullable or constructor initialization would be safer; defers errors to runtime</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>String concatenation in loops</strong>: Use <code>StringBuffer</code> instead of <code>+</code> for iterative string building</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Mutable state in <code>const</code> contexts</strong>: Fields in <code>const</code> constructor classes should not be mutable</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Ignoring <code>Future</code> return values</strong>: Use <code>await</code> or explicitly call <code>unawaited()</code> to signal intent</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong><code>var</code> where <code>final</code> works</strong>: Prefer <code>final</code> for locals and <code>const</code> for compile-time constants</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Relative imports</strong>: Use <code>package:</code> imports for consistency</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Mutable collections exposed</strong>: Public APIs should return unmodifiable views, not raw <code>List</code>/<code>Map</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Missing Dart 3 pattern matching</strong>: Prefer switch expressions and <code>if-case</code> over verbose <code>is</code> checks and manual casting</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Throwaway classes for multiple returns</strong>: Use Dart 3 records <code>(String, int)</code> instead of single-use DTOs</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong><code>print()</code> in production code</strong>: Use <code>dart:developer</code> <code>log()</code> or the project's logging package; <code>print()</code> has no log levels and cannot be filtered</li>\n</ul>\n<hr>\n<h2>3. Widget Best Practices</h2>\n<h3>Widget decomposition:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No single widget with a <code>build()</code> method exceeding ~80-100 lines</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Widgets split by encapsulation AND by how they change (rebuild boundaries)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Private <code>_build*()</code> helper methods that return widgets are extracted to separate widget classes (enables element reuse, const propagation, and framework optimizations)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Stateless widgets preferred over Stateful where no mutable local state is needed</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Extracted widgets are in separate files when reusable</li>\n</ul>\n<h3>Const usage:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>const</code> constructors used wherever possible — prevents unnecessary rebuilds</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>const</code> literals for collections that don't change (<code>const []</code>, <code>const {}</code>)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Constructor is declared <code>const</code> when all fields are final</li>\n</ul>\n<h3>Key usage:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>ValueKey</code> used in lists/grids to preserve state across reorders</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>GlobalKey</code> used sparingly — only when accessing state across the tree is truly needed</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>UniqueKey</code> avoided in <code>build()</code> — it forces rebuild every frame</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>ObjectKey</code> used when identity is based on a data object rather than a single value</li>\n</ul>\n<h3>Theming &amp; design system:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Colors come from <code>Theme.of(context).colorScheme</code> — no hardcoded <code>Colors.red</code> or hex values</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Text styles come from <code>Theme.of(context).textTheme</code> — no inline <code>TextStyle</code> with raw font sizes</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Dark mode compatibility verified — no assumptions about light background</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Spacing and sizing use consistent design tokens or constants, not magic numbers</li>\n</ul>\n<h3>Build method complexity:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No network calls, file I/O, or heavy computation in <code>build()</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No <code>Future.then()</code> or <code>async</code> work in <code>build()</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No subscription creation (<code>.listen()</code>) in <code>build()</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>setState()</code> localized to smallest possible subtree</li>\n</ul>\n<hr>\n<h2>4. State Management (Library-Agnostic)</h2>\n<p>These principles apply to all Flutter state management solutions (BLoC, Riverpod, Provider, GetX, MobX, Signals, ValueNotifier, etc.).</p>\n<h3>Architecture:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Business logic lives outside the widget layer — in a state management component (BLoC, Notifier, Controller, Store, ViewModel, etc.)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> State managers receive dependencies via injection, not by constructing them internally</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> A service or repository layer abstracts data sources — widgets and state managers should not call APIs or databases directly</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> State managers have a single responsibility — no \"god\" managers handling unrelated concerns</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Cross-component dependencies follow the solution's conventions:\n<ul>\n<li>In <strong>Riverpod</strong>: providers depending on providers via <code>ref.watch</code> is expected — flag only circular or overly tangled chains</li>\n<li>In <strong>BLoC</strong>: blocs should not directly depend on other blocs — prefer shared repositories or presentation-layer coordination</li>\n<li>In other solutions: follow the documented conventions for inter-component communication</li>\n</ul>\n</li>\n</ul>\n<h3>Immutability &amp; value equality (for immutable-state solutions: BLoC, Riverpod, Redux):</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> State objects are immutable — new instances created via <code>copyWith()</code> or constructors, never mutated in-place</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> State classes implement <code>==</code> and <code>hashCode</code> properly (all fields included in comparison)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Mechanism is consistent across the project — manual override, <code>Equatable</code>, <code>freezed</code>, Dart records, or other</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Collections inside state objects are not exposed as raw mutable <code>List</code>/<code>Map</code></li>\n</ul>\n<h3>Reactivity discipline (for reactive-mutation solutions: MobX, GetX, Signals):</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> State is only mutated through the solution's reactive API (<code>@action</code> in MobX, <code>.value</code> on signals, <code>.obs</code> in GetX) — direct field mutation bypasses change tracking</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Derived values use the solution's computed mechanism rather than being stored redundantly</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Reactions and disposers are properly cleaned up (<code>ReactionDisposer</code> in MobX, effect cleanup in Signals)</li>\n</ul>\n<h3>State shape design:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Mutually exclusive states use sealed types, union variants, or the solution's built-in async state type (e.g. Riverpod's <code>AsyncValue</code>) — not boolean flags (<code>isLoading</code>, <code>isError</code>, <code>hasData</code>)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Every async operation models loading, success, and error as distinct states</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> All state variants are handled exhaustively in UI — no silently ignored cases</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Error states carry error information for display; loading states don't carry stale data</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Nullable data is not used as a loading indicator — states are explicit</li>\n</ul>\n<pre><code>// BAD — boolean flag soup allows impossible states\nclass UserState {\n  bool isLoading = false;\n  bool hasError = false; // isLoading &amp;&amp; hasError is representable!\n  User? user;\n}\n\n// GOOD (immutable approach) — sealed types make impossible states unrepresentable\nsealed class UserState {}\nclass UserInitial extends UserState {}\nclass UserLoading extends UserState {}\nclass UserLoaded extends UserState {\n  final User user;\n  const UserLoaded(this.user);\n}\nclass UserError extends UserState {\n  final String message;\n  const UserError(this.message);\n}\n\n// GOOD (reactive approach) — observable enum + data, mutations via reactivity API\n// enum UserStatus { initial, loading, loaded, error }\n// Use your solution's observable/signal to wrap status and data separately\n</code></pre>\n<h3>Rebuild optimization:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> State consumer widgets (Builder, Consumer, Observer, Obx, Watch, etc.) scoped as narrow as possible</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Selectors used to rebuild only when specific fields change — not on every state emission</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>const</code> widgets used to stop rebuild propagation through the tree</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Computed/derived state is calculated reactively, not stored redundantly</li>\n</ul>\n<h3>Subscriptions &amp; disposal:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> All manual subscriptions (<code>.listen()</code>) are cancelled in <code>dispose()</code> / <code>close()</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Stream controllers are closed when no longer needed</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Timers are cancelled in disposal lifecycle</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Framework-managed lifecycle is preferred over manual subscription (declarative builders over <code>.listen()</code>)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>mounted</code> check before <code>setState</code> in async callbacks</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>BuildContext</code> not used after <code>await</code> without checking <code>context.mounted</code> (Flutter 3.7+) — stale context causes crashes</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No navigation, dialogs, or scaffold messages after async gaps without verifying the widget is still mounted</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>BuildContext</code> never stored in singletons, state managers, or static fields</li>\n</ul>\n<h3>Local vs global state:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Ephemeral UI state (checkbox, slider, animation) uses local state (<code>setState</code>, <code>ValueNotifier</code>)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Shared state is lifted only as high as needed — not over-globalized</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Feature-scoped state is properly disposed when the feature is no longer active</li>\n</ul>\n<hr>\n<h2>5. Performance</h2>\n<h3>Unnecessary rebuilds:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>setState()</code> not called at root widget level — localize state changes</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>const</code> widgets used to stop rebuild propagation</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>RepaintBoundary</code> used around complex subtrees that repaint independently</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>AnimatedBuilder</code> child parameter used for subtrees independent of animation</li>\n</ul>\n<h3>Expensive operations in build():</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No sorting, filtering, or mapping large collections in <code>build()</code> — compute in state management layer</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No regex compilation in <code>build()</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>MediaQuery.of(context)</code> usage is specific (e.g., <code>MediaQuery.sizeOf(context)</code>)</li>\n</ul>\n<h3>Image optimization:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Network images use caching (any caching solution appropriate for the project)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Appropriate image resolution for target device (no loading 4K images for thumbnails)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>Image.asset</code> with <code>cacheWidth</code>/<code>cacheHeight</code> to decode at display size</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Placeholder and error widgets provided for network images</li>\n</ul>\n<h3>Lazy loading:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>ListView.builder</code> / <code>GridView.builder</code> used instead of <code>ListView(children: [...])</code> for large or dynamic lists (concrete constructors are fine for small, static lists)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Pagination implemented for large data sets</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Deferred loading (<code>deferred as</code>) used for heavy libraries in web builds</li>\n</ul>\n<h3>Other:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>Opacity</code> widget avoided in animations — use <code>AnimatedOpacity</code> or <code>FadeTransition</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Clipping avoided in animations — pre-clip images</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>operator ==</code> not overridden on widgets — use <code>const</code> constructors instead</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Intrinsic dimension widgets (<code>IntrinsicHeight</code>, <code>IntrinsicWidth</code>) used sparingly (extra layout pass)</li>\n</ul>\n<hr>\n<h2>6. Testing</h2>\n<h3>Test types and expectations:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Unit tests</strong>: Cover all business logic (state managers, repositories, utility functions)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Widget tests</strong>: Cover individual widget behavior, interactions, and visual output</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Integration tests</strong>: Cover critical user flows end-to-end</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <strong>Golden tests</strong>: Pixel-perfect comparisons for design-critical UI components</li>\n</ul>\n<h3>Coverage targets:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Aim for 80%+ line coverage on business logic</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> All state transitions have corresponding tests (loading → success, loading → error, retry, etc.)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Edge cases tested: empty states, error states, loading states, boundary values</li>\n</ul>\n<h3>Test isolation:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> External dependencies (API clients, databases, services) are mocked or faked</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Each test file tests exactly one class/unit</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Tests verify behavior, not implementation details</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Stubs define only the behavior needed for each test (minimal stubbing)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No shared mutable state between test cases</li>\n</ul>\n<h3>Widget test quality:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>pumpWidget</code> and <code>pump</code> used correctly for async operations</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>find.byType</code>, <code>find.text</code>, <code>find.byKey</code> used appropriately</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No flaky tests depending on timing — use <code>pumpAndSettle</code> or explicit <code>pump(Duration)</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Tests run in CI and failures block merges</li>\n</ul>\n<hr>\n<h2>7. Accessibility</h2>\n<h3>Semantic widgets:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>Semantics</code> widget used to provide screen reader labels where automatic labels are insufficient</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>ExcludeSemantics</code> used for purely decorative elements</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>MergeSemantics</code> used to combine related widgets into a single accessible element</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Images have <code>semanticLabel</code> property set</li>\n</ul>\n<h3>Screen reader support:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> All interactive elements are focusable and have meaningful descriptions</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Focus order is logical (follows visual reading order)</li>\n</ul>\n<h3>Visual accessibility:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Contrast ratio &gt;= 4.5:1 for text against background</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Tappable targets are at least 48x48 pixels</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Color is not the sole indicator of state (use icons/text alongside)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Text scales with system font size settings</li>\n</ul>\n<h3>Interaction accessibility:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No no-op <code>onPressed</code> callbacks — every button does something or is disabled</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Error fields suggest corrections</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Context does not change unexpectedly while user is inputting data</li>\n</ul>\n<hr>\n<h2>8. Platform-Specific Concerns</h2>\n<h3>iOS/Android differences:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Platform-adaptive widgets used where appropriate</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Back navigation handled correctly (Android back button, iOS swipe-to-go-back)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Status bar and safe area handled via <code>SafeArea</code> widget</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Platform-specific permissions declared in <code>AndroidManifest.xml</code> and <code>Info.plist</code></li>\n</ul>\n<h3>Responsive design:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>LayoutBuilder</code> or <code>MediaQuery</code> used for responsive layouts</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Breakpoints defined consistently (phone, tablet, desktop)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Text doesn't overflow on small screens — use <code>Flexible</code>, <code>Expanded</code>, <code>FittedBox</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Landscape orientation tested or explicitly locked</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Web-specific: mouse/keyboard interactions supported, hover states present</li>\n</ul>\n<hr>\n<h2>9. Security</h2>\n<h3>Secure storage:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Sensitive data (tokens, credentials) stored using platform-secure storage (Keychain on iOS, EncryptedSharedPreferences on Android)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Never store secrets in plaintext storage</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Biometric authentication gating considered for sensitive operations</li>\n</ul>\n<h3>API key handling:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> API keys NOT hardcoded in Dart source — use <code>--dart-define</code>, <code>.env</code> files excluded from VCS, or compile-time configuration</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Secrets not committed to git — check <code>.gitignore</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Backend proxy used for truly secret keys (client should never hold server secrets)</li>\n</ul>\n<h3>Input validation:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> All user input validated before sending to API</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Form validation uses proper validation patterns</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No raw SQL or string interpolation of user input</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Deep link URLs validated and sanitized before navigation</li>\n</ul>\n<h3>Network security:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> HTTPS enforced for all API calls</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Certificate pinning considered for high-security apps</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Authentication tokens refreshed and expired properly</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No sensitive data logged or printed</li>\n</ul>\n<hr>\n<h2>10. Package/Dependency Review</h2>\n<h3>Evaluating pub.dev packages:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Check <strong>pub points score</strong> (aim for 130+/160)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Check <strong>likes</strong> and <strong>popularity</strong> as community signals</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Verify the publisher is <strong>verified</strong> on pub.dev</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Check last publish date — stale packages (&gt;1 year) are a risk</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Review open issues and response time from maintainers</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Check license compatibility with your project</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Verify platform support covers your targets</li>\n</ul>\n<h3>Version constraints:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Use caret syntax (<code>^1.2.3</code>) for dependencies — allows compatible updates</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Pin exact versions only when absolutely necessary</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Run <code>flutter pub outdated</code> regularly to track stale dependencies</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No dependency overrides in production <code>pubspec.yaml</code> — only for temporary fixes with a comment/issue link</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Minimize transitive dependency count — each dependency is an attack surface</li>\n</ul>\n<h3>Monorepo-specific (melos/workspace):</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Internal packages import only from public API — no <code>package:other/src/internal.dart</code> (breaks Dart package encapsulation)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Internal package dependencies use workspace resolution, not hardcoded <code>path: ../../</code> relative strings</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> All sub-packages share or inherit root <code>analysis_options.yaml</code></li>\n</ul>\n<hr>\n<h2>11. Navigation and Routing</h2>\n<h3>General principles (apply to any routing solution):</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> One routing approach used consistently — no mixing imperative <code>Navigator.push</code> with a declarative router</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Route arguments are typed — no <code>Map&lt;String, dynamic&gt;</code> or <code>Object?</code> casting</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Route paths defined as constants, enums, or generated — no magic strings scattered in code</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Auth guards/redirects centralized — not duplicated across individual screens</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Deep links configured for both Android and iOS</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Deep link URLs validated and sanitized before navigation</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Navigation state is testable — route changes can be verified in tests</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Back behavior is correct on all platforms</li>\n</ul>\n<hr>\n<h2>12. Error Handling</h2>\n<h3>Framework error handling:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>FlutterError.onError</code> overridden to capture framework errors (build, layout, paint)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>PlatformDispatcher.instance.onError</code> set for async errors not caught by Flutter</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>ErrorWidget.builder</code> customized for release mode (user-friendly instead of red screen)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Global error capture wrapper around <code>runApp</code> (e.g., <code>runZonedGuarded</code>, Sentry/Crashlytics wrapper)</li>\n</ul>\n<h3>Error reporting:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Error reporting service integrated (Firebase Crashlytics, Sentry, or equivalent)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Non-fatal errors reported with stack traces</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> State management error observer wired to error reporting (e.g., BlocObserver, ProviderObserver, or equivalent for your solution)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> User-identifiable info (user ID) attached to error reports for debugging</li>\n</ul>\n<h3>Graceful degradation:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> API errors result in user-friendly error UI, not crashes</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Retry mechanisms for transient network failures</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Offline state handled gracefully</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Error states in state management carry error info for display</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Raw exceptions (network, parsing) are mapped to user-friendly, localized messages before reaching the UI — never show raw exception strings to users</li>\n</ul>\n<hr>\n<h2>13. Internationalization (l10n)</h2>\n<h3>Setup:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Localization solution configured (Flutter's built-in ARB/l10n, easy_localization, or equivalent)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Supported locales declared in app configuration</li>\n</ul>\n<h3>Content:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> All user-visible strings use the localization system — no hardcoded strings in widgets</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Template file includes descriptions/context for translators</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> ICU message syntax used for plurals, genders, selects</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Placeholders defined with types</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No missing keys across locales</li>\n</ul>\n<h3>Code review:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Localization accessor used consistently throughout the project</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Date, time, number, and currency formatting is locale-aware</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Text directionality (RTL) supported if targeting Arabic, Hebrew, etc.</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No string concatenation for localized text — use parameterized messages</li>\n</ul>\n<hr>\n<h2>14. Dependency Injection</h2>\n<h3>Principles (apply to any DI approach):</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Classes depend on abstractions (interfaces), not concrete implementations at layer boundaries</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Dependencies provided externally via constructor, DI framework, or provider graph — not created internally</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Registration distinguishes lifetime: singleton vs factory vs lazy singleton</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Environment-specific bindings (dev/staging/prod) use configuration, not runtime <code>if</code> checks</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No circular dependencies in the DI graph</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Service locator calls (if used) are not scattered throughout business logic</li>\n</ul>\n<hr>\n<h2>15. Static Analysis</h2>\n<h3>Configuration:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>analysis_options.yaml</code> present with strict settings enabled</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Strict analyzer settings: <code>strict-casts: true</code>, <code>strict-inference: true</code>, <code>strict-raw-types: true</code></li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> A comprehensive lint rule set is included (very_good_analysis, flutter_lints, or custom strict rules)</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> All sub-packages in monorepos inherit or share the root analysis options</li>\n</ul>\n<h3>Enforcement:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> No unresolved analyzer warnings in committed code</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> Lint suppressions (<code>// ignore:</code>) are justified with comments explaining why</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>flutter analyze</code> runs in CI and failures block merges</li>\n</ul>\n<h3>Key rules to verify regardless of lint package:</h3>\n<ul>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>prefer_const_constructors</code> — performance in widget trees</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>avoid_print</code> — use proper logging</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>unawaited_futures</code> — prevent fire-and-forget async bugs</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>prefer_final_locals</code> — immutability at variable level</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>always_declare_return_types</code> — explicit contracts</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>avoid_catches_without_on_clauses</code> — specific error handling</li>\n<li><input disabled=\"disabled\" type=\"checkbox\"> <code>always_use_package_imports</code> — consistent import style</li>\n</ul>\n<hr>\n<h2>State Management Quick Reference</h2>\n<p>The table below maps universal principles to their implementation in popular solutions. Use this to adapt review rules to whichever solution the project uses.</p>\n<table>\n<thead>\n<tr>\n<th>Principle</th>\n<th>BLoC/Cubit</th>\n<th>Riverpod</th>\n<th>Provider</th>\n<th>GetX</th>\n<th>MobX</th>\n<th>Signals</th>\n<th>Built-in</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>State container</td>\n<td><code>Bloc</code>/<code>Cubit</code></td>\n<td><code>Notifier</code>/<code>AsyncNotifier</code></td>\n<td><code>ChangeNotifier</code></td>\n<td><code>GetxController</code></td>\n<td><code>Store</code></td>\n<td><code>signal()</code></td>\n<td><code>StatefulWidget</code></td>\n</tr>\n<tr>\n<td>UI consumer</td>\n<td><code>BlocBuilder</code></td>\n<td><code>ConsumerWidget</code></td>\n<td><code>Consumer</code></td>\n<td><code>Obx</code>/<code>GetBuilder</code></td>\n<td><code>Observer</code></td>\n<td><code>Watch</code></td>\n<td><code>setState</code></td>\n</tr>\n<tr>\n<td>Selector</td>\n<td><code>BlocSelector</code>/<code>buildWhen</code></td>\n<td><code>ref.watch(p.select(...))</code></td>\n<td><code>Selector</code></td>\n<td>N/A</td>\n<td>computed</td>\n<td><code>computed()</code></td>\n<td>N/A</td>\n</tr>\n<tr>\n<td>Side effects</td>\n<td><code>BlocListener</code></td>\n<td><code>ref.listen</code></td>\n<td><code>Consumer</code> callback</td>\n<td><code>ever()</code>/<code>once()</code></td>\n<td><code>reaction</code></td>\n<td><code>effect()</code></td>\n<td>callbacks</td>\n</tr>\n<tr>\n<td>Disposal</td>\n<td>auto via <code>BlocProvider</code></td>\n<td><code>.autoDispose</code></td>\n<td>auto via <code>Provider</code></td>\n<td><code>onClose()</code></td>\n<td><code>ReactionDisposer</code></td>\n<td>manual</td>\n<td><code>dispose()</code></td>\n</tr>\n<tr>\n<td>Testing</td>\n<td><code>blocTest()</code></td>\n<td><code>ProviderContainer</code></td>\n<td><code>ChangeNotifier</code> directly</td>\n<td><code>Get.put</code> in test</td>\n<td>store directly</td>\n<td>signal directly</td>\n<td>widget test</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<h2>Sources</h2>\n<ul>\n<li><a href=\"https://dart.dev/effective-dart/style\">Effective Dart: Style</a></li>\n<li><a href=\"https://dart.dev/effective-dart/usage\">Effective Dart: Usage</a></li>\n<li><a href=\"https://dart.dev/effective-dart/design\">Effective Dart: Design</a></li>\n<li><a href=\"https://docs.flutter.dev/perf/best-practices\">Flutter Performance Best Practices</a></li>\n<li><a href=\"https://docs.flutter.dev/testing/overview\">Flutter Testing Overview</a></li>\n<li><a href=\"https://docs.flutter.dev/ui/accessibility-and-internationalization/accessibility\">Flutter Accessibility</a></li>\n<li><a href=\"https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization\">Flutter Internationalization</a></li>\n<li><a href=\"https://docs.flutter.dev/ui/navigation\">Flutter Navigation and Routing</a></li>\n<li><a href=\"https://docs.flutter.dev/testing/errors\">Flutter Error Handling</a></li>\n<li><a href=\"https://docs.flutter.dev/data-and-backend/state-mgmt/options\">Flutter State Management Options</a></li>\n</ul>\n","files":[{"path":"LICENSE","sizeBytes":1071,"isText":false},{"path":"SKILL.md","sizeBytes":23194,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"notes-only","suspicious":0,"notes":2,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-12-02T16:57:10.970576Z","sha256":"9A98638E829968B197919E62C8E1C7609D545BCA6DC93A4003CFE6EE6AED116C","sizeBytes":9831},"review":null,"source":{"repositoryUrl":"https://github.com/beginwithu/agent-skills","path":"skills/flutter-dart-code-review","license":"MIT","commit":"a960304c52212f2e845067047f5cefc0c594d787","subtreeSha":"43AB76AA5A8F13C77512631192A55DB6A100924554BE041DBCEA1063B32DC2C5","lastSyncedAt":"2026-12-02T16:52:59.20206Z"},"reviewedAt":"2026-12-02T17:03:54.887656Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/beginwithu/agent-skills/tree/main/skills/flutter-dart-code-review"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install beginwithu-agent-skills@llmmart"},{"target":"git","command":"git clone https://github.com/beginwithu/agent-skills.git"}]}