flutter-dart-code-review
यह क्या करती है
यह Flutter और Dart कोड की समीक्षा (review) करने के लिए एक गाइड है। यह जांचती है कि कोड अच्छी तरह व्यवस्थित है या नहीं, अच्छे प्रोग्रामिंग तरीके इस्तेमाल हुए हैं या नहीं, और आम गलतियों से बचा गया है या नहीं। इससे फर्क नहीं पड़ता कि कौन सी state management library इस्तेमाल हो रही है।
कब इस्तेमाल करें
- ✓जब किसी और का कोड रिव्यू कर रहे हों।
- ✓किसी फीचर को फाइनल करने से पहले।
- ✓Flutter/Dart के अच्छे तरीके सीखने के लिए।
Skill का लिंक
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/flutter-dart-code-review/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस Flutter कोड को रिव्यू करो, और खास तौर पर व्यवस्थित ढांचे (organization) और संभावित गलतियों पर ध्यान दो।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह गाइड प्रोजेक्ट के ढांचे, Dart भाषा के सही इस्तेमाल, widgets (स्क्रीन के दृश्य हिस्से) बनाने के अच्छे तरीकों, और state (बदलते डेटा) को मैनेज करने के तरीके की जांच करती है। यह सुनिश्चित करती है कि कोड कुशल (efficient), accessible और सुरक्षित हो।
तकनीकी सामग्री (मूल 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.yamlis clean — no unused dependencies, versions pinned appropriately -
analysis_options.yamlincludes a strict lint set with strict analyzer settings enabled - No
print()statements in production code — usedart:developerlog()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— enablestrict-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.fieldwhere local variable promotion would work - Catching too broadly:
catch (e)withoutonclause; always specify exception types - Catching
Error:Errorsubtypes indicate bugs and should not be caught - Unused
async: Functions markedasyncthat neverawait— unnecessary overhead -
lateoveruse:lateused where nullable or constructor initialization would be safer; defers errors to runtime - String concatenation in loops: Use
StringBufferinstead of+for iterative string building - Mutable state in
constcontexts: Fields inconstconstructor classes should not be mutable - Ignoring
Futurereturn values: Useawaitor explicitly callunawaited()to signal intent -
varwherefinalworks: Preferfinalfor locals andconstfor 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-caseover verboseischecks and manual casting - Throwaway classes for multiple returns: Use Dart 3 records
(String, int)instead of single-use DTOs -
print()in production code: Usedart:developerlog()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:
-
constconstructors used wherever possible — prevents unnecessary rebuilds -
constliterals for collections that don't change (const [],const {}) - Constructor is declared
constwhen all fields are final
Key usage:
-
ValueKeyused in lists/grids to preserve state across reorders -
GlobalKeyused sparingly — only when accessing state across the tree is truly needed -
UniqueKeyavoided inbuild()— it forces rebuild every frame -
ObjectKeyused when identity is based on a data object rather than a single value
Theming & design system:
- Colors come from
Theme.of(context).colorScheme— no hardcodedColors.redor hex values - Text styles come from
Theme.of(context).textTheme— no inlineTextStylewith 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()orasyncwork inbuild() - No subscription creation (
.listen()) inbuild()
…
अक्सर पूछे जाने वाले सवाल
'library-agnostic' का क्या मतलब है?
इसका मतलब है कि ये सुझाव किसी भी state management library के साथ काम करते हैं, जैसे BLoC, Riverpod, Provider आदि, जो आप अपने Flutter प्रोजेक्ट में इस्तेमाल कर रहे हों।
फाइनल कोड में `print()` क्यों इस्तेमाल न करें?
`print()` ऐप के log को भर देता है और इसमें severity levels नहीं होते, जिससे जरूरी संदेश पहचानना मुश्किल हो जाता है। इसके लिए खास logging tools इस्तेमाल करना बेहतर है।
'widgets' क्या होते हैं?
Widgets Flutter में user interface बनाने के बिल्डिंग ब्लॉक हैं। ये टेक्स्ट, बटन, layouts जैसे visual elements को दर्शाते हैं।
जानकारी
लेखक का मूल विवरण
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
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
accessibility
280kयह आपके एजेंट को ऐसे इंटरफ़ेस बनाने में मदद करता है जिन्हें हर कोई इस्तेमाल कर सके। यह पक्का करता है कि वेबसाइट और ऐप दिव्यांग लोगों के लिए भी अच्छे से काम करें, जैसे नेत्रहीन या जिन्हें चलने-फिरने में दिक्कत होती है।
agent-architecture-audit
280kयह आपके एजेंट को जाँचने देता है कि सब कुछ सही से चल रहा है। यह AI सिस्टम में समस्याएँ ढूँढकर ठीक करता है, ताकि वे उम्मीद के मुताबिक काम करें।
agent-eval
280kयह आपके एजेंट को अलग-अलग AI coding tools की तुलना करने में मदद करता है। यह मापता है कि किसी खास काम के लिए कौन सा टूल ज़्यादा तेज़, सस्ता और भरोसेमंद है।
agent-harness-construction
280kयह आपके एजेंट को काम कैसे करना है, यह बेहतर समझने में मदद करता है। यह उन tools और instructions को बेहतर बनाता है जिनका एजेंट इस्तेमाल करता है, ताकि उसकी सफलता की संभावना बढ़े।
मिलती-जुलती skills
flutter-animating-apps
101kएजेंट को Flutter ऐप्स में एनिमेटेड इफ़ेक्ट और ट्रांज़िशन जोड़ने देता है। iOS और Android ऐप्स में मोशन और विज़ुअल डिज़ाइन बनाने के लिए यह उपयोगी है।
agent-spec-mobile-react-native
81kआपके एजेंट को React Native से iPhone और Android के लिए मोबाइल ऐप बनाने में मदद करती है, जिसमें screens, navigation और native modules शामिल हैं।
orientation
75kयह आपके एजेंट को सुनिश्चित करने में मदद करती है कि साइट पोर्ट्रेट और लैंडस्केप दोनों में चले, और ओरिएंटेशन लॉक व डिवाइस घुमाने के संदेश हटाए जाएँ।