All skills
jeffallan avatar

/flutter-expert

@efebc44
by jeffallanjeffallan/claude-skills12k stars
1,127

Use when building cross-platform applications with Flutter 3+ and Dart. Invoke for widget development, Riverpod/Bloc state management, GoRouter navigation, platform-specific implementations, performance optimization.

Use this Skill: https://skilld.dev/gh/jeffallan/claude-skills/flutter-expert

This session only. Nothing lands on disk.

referencesriverpod-state.md

≈776 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Riverpod State Management

Provider Types

import 'package:flutter_riverpod/flutter_riverpod.dart';

// Simple state
final counterProvider = StateProvider<int>((ref) => 0);

// Async state (API calls)
final usersProvider = FutureProvider<List<User>>((ref) async {
  final api = ref.read(apiProvider);
  return api.getUsers();
});

// Stream state (real-time)
final messagesProvider = StreamProvider<List<Message>>((ref) {
  return ref.read(chatServiceProvider).messagesStream;
});

Notifier Pattern (Riverpod 2.0)

@riverpod
class TodoList extends _$TodoList {
  @override
  List<Todo> build() => [];

  void add(Todo todo) {
    state = [...state, todo];
  }

  void toggle(String id) {
    state = [
      for (final todo in state)
        if (todo.id == id) todo.copyWith(completed: !todo.completed) else todo,
    ];
  }

  void remove(String id) {
    state = state.where((t) => t.id != id).toList();
  }
}

// Async Notifier
@riverpod
class UserProfile extends _$UserProfile {
  @override
  Future<User> build() async {
    return ref.read(apiProvider).getCurrentUser();
  }

  Future<void> updateName(String name) async {
    state = const AsyncValue.loading();
    state = await AsyncValue.guard(() async {
      final updated = await ref.read(apiProvider).updateUser(name: name);
      return updated;
    });
  }
}

Usage in Widgets

// ConsumerWidget (recommended)
class TodoScreen extends ConsumerWidget {
  const TodoScreen({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final todos = ref.watch(todoListProvider);

    return ListView.builder(
      itemCount: todos.length,
      itemBuilder: (context, index) {
        final todo = todos[index];
        return ListTile(
          title: Text(todo.title),
          leading: Checkbox(
            value: todo.completed,
            onChanged: (_) => ref.read(todoListProvider.notifier).toggle(todo.id),
          ),
        );
      },
    );
  }
}

// Selective rebuilds with select
class UserAvatar extends ConsumerWidget {
  const UserAvatar({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final avatarUrl = ref.watch(userProvider.select((u) => u?.avatarUrl));

    return CircleAvatar(
      backgroundImage: avatarUrl != null ? NetworkImage(avatarUrl) : null,
    );
  }
}

// Async state handling
class UserProfileScreen extends ConsumerWidget {
  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final userAsync = ref.watch(userProfileProvider);

    return userAsync.when(
      data: (user) => Text(user.name),
      loading: () => const CircularProgressIndicator(),
      error: (err, stack) => Text('Error: $err'),
    );
  }
}

Quick Reference

Provider Use Case
Provider Computed/derived values
StateProvider Simple mutable state
FutureProvider Async operations (one-time)
StreamProvider Real-time data streams
NotifierProvider Complex state with methods
AsyncNotifierProvider Async state with methods

Source: SKILL.md on GitHub

1 alert17d5 checks · Risk CRITICAL
  • Gen Agent Trust Hub17d

    The skill is a legitimate development guide for Flutter and Dart applications. It contains standard coding patterns, configuration guides, and architecture references. The URL flagged by automated scans belongs to the verified author's own repository infrastructure and presents no security risk.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer6mo

    7 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at efebc44. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 5 months ago
Other metadata
metadata
{
  "author": "https://github.com/Jeffallan",
  "version": "1.1.0",
  "domain": "frontend",
  "triggers": "Flutter, Dart, widget, Riverpod, Bloc, GoRouter, cross-platform",
  "role": "specialist",
  "scope": "implementation",
  "output-format": "code",
  "related-skills": "react-native-expert, test-master, fullstack-guardian"
}
  • flutter
  • dart
  • riverpod
  • bloc
  • gorouter
  • widget
  • state-management
  • cross-platform
  • mobile

README badge

README badge for jeffallan/claude-skills/flutter-expert

Provides patterns and workflow for building cross-platform Flutter apps with Dart, covering Riverpod or Bloc state management, GoRouter navigation, widget optimization, and performance profiling. Use this skill when implementing Flutter 3+ features, custom widgets, or debugging jank and rebuild issues.

Generated from the current SKILL.md.

Does this skill support both Riverpod and Bloc state management?
Yes. The skill covers both Riverpod (with StateNotifierProvider and ConsumerWidget) and Bloc/Cubit patterns. Load the appropriate reference guide based on your state management choice.
What versions of Flutter and Dart does this cover?
Flutter 3+ and Dart. The skill assumes a modern Flutter setup and uses current patterns like const constructors and DevTools profiling.
Does this skill include platform-specific iOS and Android implementations?
Yes. The skill covers platform-specific implementations as part of its core workflow, though detailed guidance is loaded from the performance and project structure references.
Can this skill help with performance optimization and jank fixes?
Yes. The skill includes a dedicated optimization workflow that uses Flutter DevTools profiling, identifies expensive build calls, and applies fixes like RepaintBoundary and const constructors.
Does this skill provide testing guidance?
Yes. Widget and integration testing with flutter_test is part of the core workflow, including test coverage tracking and targeted test additions when coverage drops.

Generated from the current SKILL.md. These answers refresh after source changes.