본문으로 건너뛰기
Skillpedia
모바일 앱280k · #180

flutter-dart-code-review

하는 일

이것은 Flutter와 Dart 코드를 검토하는 가이드입니다. 코드가 잘 정리되었는지, 좋은 프로그래밍 관행을 쓰는지, 흔한 오류를 피하는지 확인합니다. 사용하는 상태 관리 라이브러리와는 무관합니다.

사용하는 경우

  • ✓다른 사람의 코드를 검토할 때.
  • ✓기능을 마무리하기 전에 검토할 때.
  • ✓Flutter/Dart의 모범 사례를 배울 때.

스킬 링크

https://github.com/affaan-m/ECC/blob/main/pi/core/skills/flutter-dart-code-review/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/affaan-m/ECC/blob/main/pi/core/skills/flutter-dart-code-review/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 Flutter 코드를 검토하고, 구성과 잠재 오류에 대한 모범 사례에 집중해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

가이드는 프로젝트 구조, Dart 언어의 올바른 사용, 위젯(화면의 시각적 부분)을 만드는 모범 사례, 상태(변하는 데이터)가 어떻게 관리되는지 점검합니다. 코드가 효율적이고, 접근성이 있으며, 안전한지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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()

…

자주 묻는 질문

'라이브러리에 얽매이지 않는다'는 무슨 뜻인가요?

Flutter 프로젝트에서 어떤 상태 관리 라이브러리(BLoC, Riverpod, Provider 등)를 쓰든 이 팁이 적용된다는 뜻입니다.

최종 코드에서 print()를 쓰지 않는 이유는 무엇인가요?

print()는 앱 로그를 어지럽히고 심각도 수준이 없어서 중요한 메시지를 찾기 어렵게 만듭니다. 전용 로깅 도구를 쓰는 편이 낫습니다.

'위젯'이란 무엇인가요?

Flutter에서 사용자 인터페이스를 구성하는 기본 블록입니다. 텍스트, 버튼, 레이아웃 같은 시각 요소를 나타냅니다.

상세 정보

작성자의 원본 설명

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.

repo: affaan-m/ECC

인기도

GitHub 스타
280k
순위
#180
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬