मुख्य सामग्री पर जाएँ
Skillpedia
मोबाइल ऐप280k · #180

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 पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/affaan-m/ECC/blob/main/pi/core/skills/flutter-dart-code-review/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

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

…

अक्सर पूछे जाने वाले सवाल

'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

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

accessibility

280k

यह आपके एजेंट को ऐसे इंटरफ़ेस बनाने में मदद करता है जिन्हें हर कोई इस्तेमाल कर सके। यह पक्का करता है कि वेबसाइट और ऐप दिव्यांग लोगों के लिए भी अच्छे से काम करें, जैसे नेत्रहीन या जिन्हें चलने-फिरने में दिक्कत होती है।

डिज़ाइनइंटरफ़ेस (UI/UX)

agent-architecture-audit

280k

यह आपके एजेंट को जाँचने देता है कि सब कुछ सही से चल रहा है। यह AI सिस्टम में समस्याएँ ढूँढकर ठीक करता है, ताकि वे उम्मीद के मुताबिक काम करें।

AI और एजेंटएजेंट

agent-eval

280k

यह आपके एजेंट को अलग-अलग AI coding tools की तुलना करने में मदद करता है। यह मापता है कि किसी खास काम के लिए कौन सा टूल ज़्यादा तेज़, सस्ता और भरोसेमंद है।

AI और एजेंटएजेंट

agent-harness-construction

280k

यह आपके एजेंट को काम कैसे करना है, यह बेहतर समझने में मदद करता है। यह उन tools और instructions को बेहतर बनाता है जिनका एजेंट इस्तेमाल करता है, ताकि उसकी सफलता की संभावना बढ़े।

AI और एजेंटएजेंट

मिलती-जुलती skills