flutter-dart-code-review

affaan-m/everything-claude-code · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/affaan-m/everything-claude-code --skill flutter-dart-code-review
0 commentsdiscussion
summary

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.

skill.md

Flutter/Dart Code Review Best Practices

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.


1. General Project Health

  • Project follows consistent folder structure (feature-first or layer-first)
  • Proper separation of concerns: UI, business logic, data layers
  • No business logic in widgets; widgets are purely presentational
  • pubspec.yaml is clean — no unused dependencies, versions pinned appropriately
  • analysis_options.yaml includes a strict lint set with strict analyzer settings enabled
  • No print() statements in production code — use dart:developer log() or a logging package
  • Generated files (.g.dart, .freezed.dart, .gr.dart) are up-to-date or in .gitignore
  • Platform-specific code isolated behind abstractions

2. Dart Language Pitfalls

  • Implicit dynamic: Missing type annotations leading to dynamic — enable strict-casts, strict-inference, strict-raw-types
  • Null safety misuse: Excessive ! (bang operator) instead of proper null checks or Dart 3 pattern matching (if (value case var v?))
  • Type promotion failures: Using this.field where local variable promotion would work
  • Catching too broadly: catch (e) without on clause; always specify exception types
  • Catching Error: Error subtypes indicate bugs and should not be caught
  • Unused async: Functions marked async that never await — unnecessary overhead
  • late overuse: late used where nullable or constructor initialization would be safer; defers errors to runtime
  • String concatenation in loops: Use StringBuffer instead of + for iterative string building
  • Mutable state in const contexts: Fields in const constructor classes should not be mutable
  • Ignoring Future return values: Use await or explicitly call unawaited() to signal intent
  • var where final works: Prefer final for locals and const for compile-time constants
  • Relative imports: Use package: imports for consistency
  • Mutable collections exposed: Public APIs should return unmodifiable views, not raw List/Map
  • Missing Dart 3 pattern matching: Prefer switch expressions and if-case over verbose is checks and manual casting
  • Throwaway classes for multiple returns: Use Dart 3 records (String, int) instead of single-use DTOs
  • print() in production code: Use dart:developer log() or the project's logging package; print() has no log levels and cannot be filtered

3. Widget Best Practices

Widget decomposition:

  • No single widget with a build() method exceeding ~80-100 lines
  • Widgets split by encapsulation AND by how they change (rebuild boundaries)
  • Private _build*() helper methods that return widgets are extracted to separate widget classes (enables element reuse, const propagation, and framework optimizations)
  • Stateless widgets preferred over Stateful where no mutable local state is needed
  • Extracted widgets are in separate files when reusable

Const usage:

  • const constructors used wherever possible — prevents unnecessary rebuilds
  • const literals for collections that don't change (const [], const {})
  • Constructor is declared const when all fields are final

Key usage:

  • ValueKey used in lists/grids to preserve state across reorders
  • GlobalKey used sparingly — only when accessing state across the tree is truly needed
  • UniqueKey avoided in build() — it forces rebuild every frame
  • ObjectKey used when identity is based on a data object rather than a single value

Theming & design system:

  • Colors come from Theme.of(context).colorScheme — no hardcoded Colors.red or hex values
  • Text styles come from Theme.of(context).textTheme — no inline TextStyle with raw font sizes
  • Dark mode compatibility verified — no assumptions about light background
  • Spacing and sizing use consistent design tokens or constants, not magic numbers

Build method complexity:

  • No network calls, file I/O, or heavy computation in build()
  • No Future.then() or async work in build()
  • No subscription creation (.listen()) in build()
  • setState() localized to smallest possible subtree

4. State Management (Library-Agnostic)

These principles apply to all Flutter state management solutions (BLoC, Riverpod, Provider, GetX, MobX, Signals, ValueNotifier, etc.).

Architecture:

  • Business logic lives outside the widget layer — in a state management component (BLoC, Notifier, Controller, Store, ViewModel, etc.)
  • State managers receive dependencies via injection, not by constructing them internally
  • A service or repository layer abstracts data sources — widgets and state managers should not call APIs or databases directly
  • State managers have a single responsibility — no "god" managers handling unrelated concerns
  • Cross-component dependencies follow the solution's conventions:
    • In Riverpod: providers depending on providers via ref.watch is expected — flag only circular or overly tangled chains
    • In BLoC: blocs should not directly depend on other blocs — prefer shared repositories or presentation-layer coordination
    • In other solutions: follow the documented conventions for inter-component communication

Immutability & value equality (for immutable-state solutions: BLoC, Riverpod, Redux):

  • State objects are immutable — new instances created via copyWith() or constructors, never mutated in-place
  • State classes implement == and hashCode properly (all fields included in comparison)
  • Mechanism is consistent across the project — manual override, Equatable, freezed, Dart records, or other
  • Collections inside state objects are not exposed as raw mutable List/Map

Reactivity discipline (for reactive-mutation solutions: MobX, GetX, Signals):

  • State is only mutated through the solution's reactive API (@action in MobX, .value on signals, .obs in GetX) — direct field mutation bypasses change tracking
  • Derived values use the solution's computed mechanism rather than being stored redundantly
  • Reactions and disposers are properly cleaned up (ReactionDisposer in MobX, effect cleanup in Signals)

State shape design:

  • Mutually exclusive states use sealed types, union variants, or the solution's built-in async state type (e.g. Riverpod's AsyncValue) — not boolean flags (isLoading, isError, hasData)
  • Every async operation models loading, success, and error as distinct states
  • All state variants are handled exhaustively in UI — no silently ignored cases
  • Error states carry error information for display; loading states don't carry stale data
  • Nullable data is not used as a loading indicator — states are explicit
// BAD — boolean flag soup allows impossible states
class UserState {
  bool isLoading = false;
  bool hasError = false; // isLoading && hasError is representable!
  User? user;
}

// GOOD (immutable approach) — sealed types make impossible states unrepresentable
sealed class UserState {}
class UserInitial extends UserState {}
class UserLoading extends UserState {}
class UserLoaded extends UserState {
  final User user;
  const UserLoaded(this.user);
}
class UserError extends UserState {
  final String message;
  const UserError(this.message);
}

// GOOD (reactive approach) — observable enum + data, mutations via reactivity API
// enum UserStatus { initial, loading, loaded, error }
// Use your solution's observable/signal to wrap status and data separately

Rebuild optimization:

  • State consumer widgets (Builder, Consumer, Observer, Obx, Watch, etc.) scoped as narrow as possible
  • Selectors used to rebuild only when specific fields change — not on every state emission
  • const widgets used to stop rebuild propagation through the tree
  • Computed/derived state is calculated reactively, not stored redundantly

Subscriptions & disposal:

  • All manual subscriptions (.listen()) are cancelled in dispose() / close()
  • Stream controllers are closed when no longer needed
  • Timers are cancelled in disposal lifecycle
  • Framework-managed lifecycle is preferred over manual subscription (declarative builders over .listen())
  • mounted check before setState in async callbacks
  • BuildContext not used after await without checking context.mounted (Flutter 3.7+) — stale context causes crashes
  • No navigation, dialogs, or scaffold messages after async gaps without verifying the widget is still mounted
  • BuildContext never stored in singletons, state managers, or static fields

Local vs global state:

  • Ephemeral UI state (checkbox, slider, animation) uses local state (setState, ValueNotifier)
  • Shared state is lifted only as high as needed — not over-globalized
  • Feature-scoped state is properly disposed when the feature is no longer active

5. Performance

Unnecessary rebuilds:

  • setState() not called at root widget level — localize state changes
  • const widgets used to stop rebuild propagation
  • RepaintBoundary used around complex subtrees that repaint independently
  • AnimatedBuilder child parameter used for subtrees independent of animation

Expensive operations in build():

  • No sorting, filtering, or mapping large collections in build() — compute in state management layer
  • No regex compilation in build()
  • MediaQuery.of(context) usage is specific (e.g., MediaQuery.sizeOf(context))

Image optimization:

  • Network images use caching (any caching solution appropriate for the project)
  • Appropriate image resolution for target device (no loading 4K images for thumbnails)
  • Image.asset with cacheWidth/cacheHeight to decode at display size
  • Placeholder and error widgets provided for network images

Lazy loading:

  • ListView.builder / GridView.builder used instead of ListView(children: [...]) for large or dynamic lists (concrete constructors are fine for small, static lists)
  • Pagination implemented for large data sets
  • Deferred loading (deferred as) used for heavy libraries in web builds

Other:

  • Opacity widget avoided in animations — use AnimatedOpacity or FadeTransition
  • Clipping avoided in animations — pre-clip images
  • operator == not overridden on widgets — use const constructors instead
  • Intrinsic dimension widgets (IntrinsicHeight, IntrinsicWidth) used sparingly (extra layout pass)

6. Testing

Test types and expectations:

  • Unit tests: Cover all business logic (state managers, repositories, utility functions)
  • Widget tests: Cover individual widget behavior, interactions, and visual output
  • Integration tests: Cover critical user flows end-to-end
  • Golden tests: Pixel-perfect comparisons for design-critical UI components

Coverage targets:

  • Aim for 80%+ line coverage on business logic
  • All state transitions have corresponding tests (loading → success, loading → error, retry, etc.)
  • Edge cases tested: empty states, error states, loading states, boundary values

Test isolation:

  • External dependencies (API clients, databases, services) are mocked or faked
  • Each test file tests exactly one class/unit
  • Tests verify behavior, not implementation details
  • Stubs define only the behavior needed for each test (minimal stubbing)
  • No shared mutable st
how to use flutter-dart-code-review

How to use flutter-dart-code-review on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add flutter-dart-code-review
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/affaan-m/everything-claude-code --skill flutter-dart-code-review

The skills CLI fetches flutter-dart-code-review from GitHub repository affaan-m/everything-claude-code and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/flutter-dart-code-review

Reload or restart Cursor to activate flutter-dart-code-review. Access the skill through slash commands (e.g., /flutter-dart-code-review) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.533 reviews
  • Pratham Ware· Dec 28, 2024

    Keeps context tight: flutter-dart-code-review is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Luis Jackson· Dec 20, 2024

    I recommend flutter-dart-code-review for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Kofi Chen· Dec 12, 2024

    flutter-dart-code-review fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Liam Kapoor· Dec 4, 2024

    Useful defaults in flutter-dart-code-review — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Kofi Wang· Nov 23, 2024

    flutter-dart-code-review has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Sakshi Patil· Nov 19, 2024

    Registry listing for flutter-dart-code-review matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Camila Thompson· Nov 11, 2024

    Solid pick for teams standardizing on skills: flutter-dart-code-review is focused, and the summary matches what you get after install.

  • Olivia Chawla· Oct 14, 2024

    Solid pick for teams standardizing on skills: flutter-dart-code-review is focused, and the summary matches what you get after install.

  • Chaitanya Patil· Oct 10, 2024

    flutter-dart-code-review reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Yusuf Huang· Oct 2, 2024

    flutter-dart-code-review has been reliable in day-to-day use. Documentation quality is above average for community skills.

showing 1-10 of 33

1 / 4