Back to Skills

dart-flutter-patterns

Production-ready Dart and Flutter patterns covering null safety, immutable state, async composition, widget architecture, popular state management frameworks (BLoC, Riverpod, Provider), GoRouter navigation, Dio networking, Freezed code generation, and clean architecture.

187,873stars29,078forksUpdated 5/21/2026

Security Assessment

Low Risk(85/100)

Detected risks:

Secret Exposure([SKILL.md] token =)
Security Score85/100

About dart-flutter-patterns

The dart-flutter-patterns skill provides developers with production-ready Dart and Flutter patterns to write safer, more maintainable, and idiomatic applications. It addresses common challenges in Flutter development, such as null safety, immutable state management, async composition, widget architecture, and integrating popular state management frameworks like BLoC, Riverpod, and Provider. By following the patterns in this skill, developers can avoid runtime errors, reduce boilerplate code, and implement robust features efficiently.

This skill offers a comprehensive set of features, including guidance for null safety using modern Dart patterns, immutable state handling with sealed classes and Freezed code generation, and best practices for async programming. It covers widget architecture recommendations such as const propagation and scoped rebuilds, navigation with GoRouter including reactive authentication guards, networking using Dio with interceptors and token refresh strategies, global error handling with crashlytics integration, and testing strategies for unit and widget tests. Each feature is supported with copy-paste-ready code examples, illustrating practical implementations in real-world Flutter applications.

The skill is ideal for developers starting new Flutter projects, reviewing or refactoring existing code, or integrating complex features such as secure HTTP clients, local storage, and WebView components. It also targets developers writing tests for widgets, Cubits, or Riverpod providers, and those who need guidance in wiring up GoRouter for authenticated navigation flows. Essentially, any Flutter developer seeking structured, production-oriented patterns to increase code quality, reduce errors, and adhere to best practices will benefit from this skill.

FAQ

Can I use this skill with existing Flutter projects?

Yes, the skill is designed to be library-agnostic where possible and can be applied to both new and existing Flutter projects to improve code safety and structure.

Which state management frameworks are supported?

The skill provides patterns for BLoC, Riverpod, and Provider, including guidance on events, notifiers, derived providers, and testing strategies for each.

Does this skill require Dart 3 features?

Some patterns, such as advanced null safety and pattern matching, leverage Dart 3 features. Basic patterns are compatible with earlier Dart versions, but full idiomatic use is recommended with Dart 3.

Can I use the navigation patterns with authentication flows?

Yes, the GoRouter patterns include reactive auth guards using refreshListenable, allowing for secure and responsive navigation based on authentication state.

Are there testing patterns included?

Yes, the skill provides unit testing for BLoC/Cubit and widget testing examples using ProviderScope overrides and fakes to promote robust and maintainable test code.

Install dart-flutter-patterns

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill