agentsclimarketplace

Flutter patterns

Skill RadKod/claude-agents-kit/flutter/.claude/skills/flutter-patterns

Flutter MVVM pattern'leri. Screen, ViewModel, Repository, freezed model, go_router. Feature implement ederken kullan.From its SKILL.md

Install
npx -y skills add RadKod/claude-agents-kit --skill flutter-patterns

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.6 KB, 819 tokens by cl100k_base, as published. Nobody here has run it

Feature Scaffold (MVVM)

1. Model (freezed)

import 'package:freezed_annotation/freezed_annotation.dart';

part 'user_model.freezed.dart';
part 'user_model.g.dart';

@freezed
class UserModel with _$UserModel {
  const factory UserModel({
    required String id,
    required String name,
    required String email,
    String? avatarUrl,
  }) = _UserModel;

  factory UserModel.fromJson(Map<String, dynamic> json) =>
      _$UserModelFromJson(json);
}

2. Repository

class AuthRepository {
  AuthRepository(this._apiClient, this._localStorage);
  final ApiClient _apiClient;
  final LocalStorage _localStorage;

  Future<UserModel> login(String email, String password) async {
    final response = await _apiClient.login(email, password);
    await _localStorage.saveToken(response.token);
    return response.user;
  }
}

// Riverpod provider
@riverpod
AuthRepository authRepository(Ref ref) {
  return AuthRepository(ref.watch(apiClientProvider), ref.watch(localStorageProvider));
}

3. ViewModel (AsyncNotifier)

@riverpod
class AuthViewModel extends _$AuthViewModel {
  @override
  FutureOr<UserModel?> build() => null;

  Future<void> login(String email, String password) async {
    state = const AsyncLoading();
    state = await AsyncValue.guard(() =>
      ref.read(authRepositoryProvider).login(email, password),
    );
  }
}

4. View (Screen)

class LoginScreen extends ConsumerWidget {
  const LoginScreen({super.key});

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

    ref.listen(authViewModelProvider, (_, next) {
      next.whenOrNull(
        data: (user) {
          if (user != null) context.go('/home');
        },
        error: (e, _) => ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text(e.toString()))),
      );
    });

    return Scaffold(
      body: authState.isLoading
          ? const Center(child: CircularProgressIndicator())
          : LoginForm(
              onSubmit: (email, password) =>
                  ref.read(authViewModelProvider.notifier).login(email, password),
            ),
    );
  }
}

go_router Setup

final routerProvider = Provider<GoRouter>((ref) {
  return GoRouter(
    initialLocation: '/login',
    routes: [
      GoRoute(path: '/login', builder: (_, __) => const LoginScreen()),
      GoRoute(path: '/home', builder: (_, __) => const HomeScreen()),
      ShellRoute(
        builder: (_, __, child) => ScaffoldWithNavBar(child: child),
        routes: [
          GoRoute(path: '/feed', builder: (_, __) => const FeedScreen()),
          GoRoute(path: '/profile', builder: (_, __) => const ProfileScreen()),
        ],
      ),
    ],
    redirect: (context, state) {
      final isLoggedIn = ref.read(authStateProvider) != null;
      if (!isLoggedIn && state.matchedLocation != '/login') return '/login';
      return null;
    },
  );
});

Dio + Retrofit API Client

@RestApi()
abstract class ApiClient {
  factory ApiClient(Dio dio) = _ApiClient;

  @POST('/auth/login')
  Future<LoginResponse> login(@Body() LoginRequest request);

  @GET('/users/{id}')
  Future<UserModel> getUser(@Path('id') String id);
}

@riverpod
ApiClient apiClient(Ref ref) {
  final dio = Dio(BaseOptions(baseUrl: Env.apiBaseUrl))
    ..interceptors.addAll([
      AuthInterceptor(ref),
      LogInterceptor(requestBody: true, responseBody: true),
    ]);
  return ApiClient(dio);
}

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,758. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.