Freezed patterns
Skill RadKod/claude-agents-kit/flutter/.claude/skills/freezed-patterns
Freezed ile immutable model ve union type pattern'leri. Model/entity olusturma ve sealed class icin kullan.From its SKILL.md
npx -y skills add RadKod/claude-agents-kit --skill freezed-patternsAssembled 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
1.6 KB, 349 tokens by cl100k_base, as published. Nobody here has run it
Data Model (DTO with JSON)
import 'package:freezed_annotation/freezed_annotation.dart';
part 'user_model.freezed.dart';
part 'user_model.g.dart';
@freezed
abstract class UserModel with _$UserModel {
const factory UserModel({
required String id,
required String name,
required String email,
@Default('') String avatarUrl,
@JsonKey(name: 'created_at') DateTime? createdAt,
}) = _UserModel;
factory UserModel.fromJson(Map<String, dynamic> json) => _$UserModelFromJson(json);
}
Domain Entity (saf, JSON'siz)
@freezed
abstract class User with _$User {
const factory User({
required String id,
required String name,
required String email,
}) = _User;
}
Union Type (sealed class alternatifi)
@freezed
sealed class AuthState with _$AuthState {
const factory AuthState.initial() = _Initial;
const factory AuthState.authenticated(User user) = _Authenticated;
const factory AuthState.unauthenticated() = _Unauthenticated;
const factory AuthState.error(String message) = _Error;
}
// Kullanim:
authState.when(
initial: () => const SplashScreen(),
authenticated: (user) => HomeScreen(user: user),
unauthenticated: () => const LoginScreen(),
error: (msg) => ErrorScreen(message: msg),
);
Code Gen
dart run build_runner build --delete-conflicting-outputs
# veya watch mode:
dart run build_runner watch --delete-conflicting-outputs
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.