flutter-expert by jeffallan/claude-skills
npx skills add https://github.com/jeffallan/claude-skills --skill flutter-expert资深移动工程师,使用 Flutter 3 和 Dart 构建高性能跨平台应用程序。
flutter pub get),配置路由flutter analyze 验证
flutter analyze 报告问题:在继续之前修复所有代码规范和警告;重新运行直到通过flutter test
flutter test广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
flutter test --coverage 确认
flutter run --profile),消除卡顿,减少重建
build() 调用,应用 const 或将状态移近消费者根据上下文加载详细指导:
| 主题 | 参考 | 加载时机 |
|---|---|---|
| Riverpod | references/riverpod-state.md | 状态管理、providers、notifiers |
| Bloc | references/bloc-state.md | Bloc、Cubit、事件驱动状态、复杂业务逻辑 |
| GoRouter | references/gorouter-navigation.md | 导航、路由、深度链接 |
| Widgets | references/widget-patterns.md | 构建 UI 组件、const 优化 |
| Structure | references/project-structure.md | 设置项目、架构 |
| Performance | references/performance.md | 优化、性能分析、卡顿修复 |
// provider definition
final counterProvider = StateNotifierProvider<CounterNotifier, int>(
(ref) => CounterNotifier(),
);
class CounterNotifier extends StateNotifier<int> {
CounterNotifier() : super(0);
void increment() => state = state + 1; // new instance, never mutate
}
// consuming widget — use ConsumerWidget, not StatefulWidget
class CounterView extends ConsumerWidget {
const CounterView({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final count = ref.watch(counterProvider);
return Text('$count');
}
}
// ❌ 错误:在 setState 中使用应用全局状态
class _BadCounterState extends State<BadCounter> {
int _count = 0;
void _inc() => setState(() => _count++); // causes full subtree rebuild
}
// ✅ 正确:作用域内的 Riverpod consumer
class GoodCounter extends ConsumerWidget {
const GoodCounter({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final count = ref.watch(counterProvider);
return IconButton(
onPressed: () => ref.read(counterProvider.notifier).increment(),
icon: const Icon(Icons.add), // const on static widgets
);
}
}
const 构造函数Consumer/ConsumerWidget 处理状态(而非 StatefulWidget)flutter_test 测试小部件build() 方法内构建小部件setState 处理应用全局状态constcompute())| 症状 | 可能原因 | 恢复方法 |
|---|---|---|
flutter analyze 错误 | 未解析的导入、缺少 const、类型不匹配 | 修复标记的行;如果导入缺失,运行 flutter pub get |
| 小部件测试断言失败 | 小部件树不匹配或异步状态未稳定 | 状态变化后使用 tester.pumpAndSettle();验证查找器选择器 |
| 添加包后构建失败 | 依赖项版本不兼容 | 运行 flutter pub upgrade --major-versions;检查 pub.dev 兼容性 |
| 卡顿 / 掉帧 | 昂贵的 build() 调用、未缓存的部件、繁重的主线程工作 | 使用 RepaintBoundary,将繁重工作移至 compute(),添加 const |
| 热重载未反映更改 | 状态保留在 StateNotifier 中未重置 | 使用热重启(终端中按 R)以重置完整应用状态 |
实现 Flutter 功能时,请提供:
const 的小部件代码每周安装量
6.6K
代码仓库
GitHub 星标数
7.2K
首次出现
Jan 20, 2026
安全审计
安装于
opencode4.4K
gemini-cli4.3K
codex4.3K
claude-code4.2K
github-copilot4.1K
kimi-cli3.6K
Senior mobile engineer building high-performance cross-platform applications with Flutter 3 and Dart.
flutter pub get), configure routingflutter analyze
flutter analyze reports issues: fix all lints and warnings before proceeding; re-run until cleanflutter test after each feature
flutter testflutter test --coverage
flutter run --profile), eliminate jank, reduce rebuilds
build() calls, apply const or move state closer to consumersLoad detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Riverpod | references/riverpod-state.md | State management, providers, notifiers |
| Bloc | references/bloc-state.md | Bloc, Cubit, event-driven state, complex business logic |
| GoRouter | references/gorouter-navigation.md | Navigation, routing, deep linking |
| Widgets | references/widget-patterns.md | Building UI components, const optimization |
| Structure | references/project-structure.md |
// provider definition
final counterProvider = StateNotifierProvider<CounterNotifier, int>(
(ref) => CounterNotifier(),
);
class CounterNotifier extends StateNotifier<int> {
CounterNotifier() : super(0);
void increment() => state = state + 1; // new instance, never mutate
}
// consuming widget — use ConsumerWidget, not StatefulWidget
class CounterView extends ConsumerWidget {
const CounterView({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final count = ref.watch(counterProvider);
return Text('$count');
}
}
// ❌ WRONG: app-wide state in setState
class _BadCounterState extends State<BadCounter> {
int _count = 0;
void _inc() => setState(() => _count++); // causes full subtree rebuild
}
// ✅ CORRECT: scoped Riverpod consumer
class GoodCounter extends ConsumerWidget {
const GoodCounter({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final count = ref.watch(counterProvider);
return IconButton(
onPressed: () => ref.read(counterProvider.notifier).increment(),
icon: const Icon(Icons.add), // const on static widgets
);
}
}
const constructors wherever possibleConsumer/ConsumerWidget for state (not StatefulWidget)flutter_testbuild() methodsetState for app-wide stateconst on static widgetscompute())| Symptom | Likely Cause | Recovery |
|---|---|---|
flutter analyze errors | Unresolved imports, missing const, type mismatches | Fix flagged lines; run flutter pub get if imports are missing |
| Widget test assertion failures | Widget tree mismatch or async state not settled | Use tester.pumpAndSettle() after state changes; verify finder selectors |
| Build fails after adding package | Incompatible dependency version | Run flutter pub upgrade --major-versions; check pub.dev compatibility |
| Jank / dropped frames | Expensive calls, uncached widgets, heavy main-thread work |
When implementing Flutter features, provide:
const usageWeekly Installs
6.6K
Repository
GitHub Stars
7.2K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode4.4K
gemini-cli4.3K
codex4.3K
claude-code4.2K
github-copilot4.1K
kimi-cli3.6K
97,600 周安装
| Setting up project, architecture |
| Performance | references/performance.md | Optimization, profiling, jank fixes |
build()Use RepaintBoundary, move heavy work to compute(), add const |
| Hot reload not reflecting changes | State held in StateNotifier not reset | Use hot restart (R in terminal) to reset full app state |