dart-logic-patterns

Algorithms & Logic

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "dart-logic-patterns" with this command: npx skills add dhruvanbhalara/skills/dhruvanbhalara-skills-dart-logic-patterns

Algorithms & Logic

The efficiency of your business logic directly impacts battery life and responsiveness.

Complexity Analysis

  • Big O Awareness: Understand the cost of your operations. Avoid O(n²) or higher on the main thread for datasets larger than a few hundred items.

  • Data Structure Selection:

  • Map : Fast key-based lookups.

  • Set : Fast unique item management.

  • List : Fast indexing and sequential access.

  • LinkedHashSet/Map : Preserves insertion order while providing fast lookups.

Logic Patterns

  • Debouncing: Delay execution until a user stops interacting (e.g., search-as-you-type).

  • Throttling: Limit execution to at most once every interval (e.g., scrolling events).

  • Memoization: Cache the results of expensive pure functions based on their arguments. Use package:memoize or custom implementations.

Search & Sort

  • Binary Search: Use for sorted lists to transform O(n) searches into O(log n).

  • Efficient Sorting: Use Dart's built-in list.sort() , which uses highly optimized algorithms. Provide targeted Comparable implementations for custom objects.

Business Logic Organization

  • Pure Functions: Keep business logic in pure, testable functions outside of UI classes.

  • Fail Fast: Use guard clauses to handle edge cases and invalid states early.

  • Validation Logic: Keep complex validation in a separate domain layer, reusable across different screens.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

flutter-architecture

No summary provided by upstream source.

Repository SourceNeeds Review
General

flutter-ui

No summary provided by upstream source.

Repository SourceNeeds Review
General

flutter-bloc

No summary provided by upstream source.

Repository SourceNeeds Review
General

flutter-dio

No summary provided by upstream source.

Repository SourceNeeds Review