用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/aloisdeniel/skills --skill dev-flutter-patterns命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | dev-flutter-patterns |
| description | Common Flutter specific development patterns. Triggers: flutter, mobile, app, riverpod |
This skill provides common Flutter development patterns to be used when developping Flutter apps with Riverpod.
const widgets instances whenever possiblereturn const Padding(
padding: EdgeInsets.all(8.0),
child: Icon(Icons.star),
);
ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
final item = items[index];
return Tile(
key: ValueKey(item.id), // Unique key based on item ID
data: item,
);
},
);
$final $example = Provider<Example>((ref) {
return Example();
});
$load<Name> and $namefinal $loadExample = FutureProvider<Example>((ref) async {
// Async initialization logic
});
final $example = Provider<Example>((ref) {
final asyncValue = ref.watch($loadExample);
return switch (asyncValue) {
AsyncData(value) => value,
_ => throw Exception('Example is not initialized'),
}
AsyncValue for asynchronous loading statesclass ExampleNotifier extends AsyncNotifier<State> {
@override
Future<State> build() async {
// Initial loading state
return fetchData();
}
Future<void> refresh() async {
// Set loading state
state = const AsyncValue.loading();
try {
final data = await fetchData();
// Set data state
state = AsyncValue.data(data);
} catch (e, st) {
// Set error state
state = AsyncValue.error(e, st);
}
}
}
ConsumerWidget and watch $l10n insteadclass Example extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final l10n = ref.watch($l10n);
return Text(l10n.exampleHelloWorld);
}
}