design-patternslisted
Install: claude install-skill IuliaIvanaPatras/claude-code-templates
# Flutter Design Patterns Skill
Quick reference for common design patterns in Flutter with Dart 3.11, Riverpod 3.x, and Clean Architecture.
## When to Use
- User asks to implement a specific pattern
- Designing reusable or extensible features
- Refactoring rigid, duplicated, or untestable code
## Quick Reference: When to Use What
| Problem | Pattern | Use When |
|---------|---------|----------|
| Flexible UI with variations | **Widget Composition** | Building reusable component APIs |
| Data layer abstraction | **Repository** | API calls, local DB, caching strategy |
| Screen business logic | **MVVM (AsyncNotifier)** | Feature screens with async data |
| Swappable algorithms | **Strategy** | Payment processing, sorting, auth methods |
| Reactive data streams | **Observer (Streams)** | Real-time updates, WebSocket, SSE |
| Exhaustive state handling | **Sealed Class Union** | Loading/success/error, navigation events |
| Expensive shared resource | **Singleton (Riverpod)** | Dio client, SharedPreferences, analytics |
| Platform-specific widgets | **Factory** | iOS vs Android adaptive UI |
---
## Widget Composition
### Slot Pattern
**Problem:** Build flexible widgets that accept custom content in specific positions.
```dart
/// Reusable list tile with configurable slots
class AppListTile extends StatelessWidget {
const AppListTile({
required this.title,
this.subtitle,
this.leading,
this.trailing,
this.onTap,
super.key,
});
final Widget titl