flutter-expert by 404kidwiz/claude-supercode-skills
npx skills add https://github.com/404kidwiz/claude-supercode-skills --skill flutter-expert提供跨平台移动开发专业知识,专注于 Flutter 3+、Dart 编程和 Riverpod 状态管理。为移动端、Web 端和桌面端构建高保真应用程序,具备高级渲染优化(Impeller)、自定义渲染对象以及通过 FFI 和 Method Channels 的原生集成能力。
| 模式 | 最佳适用场景 | 复杂度 | 优点 |
|---|---|---|---|
| Riverpod | 默认选择 | 中等 | 编译时安全,不依赖上下文,可测试。 |
| BLoC/Cubit | 企业级应用 | 高 | 严格的事件/状态分离,非常适合日志记录/分析。 |
| Provider | 遗留/简单应用 | 低 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 内置,简单,但依赖 BuildContext。 |
| GetX | 快速构建 MVP | 低 | "魔法"式响应,样板代码少,但模式非标准。 |
How to talk to Native?
│
├─ **Method Channels (Standard)**
│ ├─ Async calls? → **MethodChannel**
│ └─ Streams? → **EventChannel**
│
├─ **FFI (High Performance)**
│ ├─ C/C++ Library? → **dart:ffi**
│ └─ Rust Library? → **Flutter Rust Bridge**
│
└─ **Platform Views (UI)**
├─ Native UI inside Flutter? → **AndroidView / UiKitView**
└─ Performance Critical? → **Hybrid Composition**
RepaintBoundary 来隔离重绘区域(例如,视频播放器、旋转加载指示器)。危险信号 → 升级给 mobile-developer(原生开发):
目标: 创建视觉效果(例如,像素化)。
步骤:
着色器代码 (shaders/pixelate.frag)
#include <flutter/runtime_effect.glsl>
uniform vec2 uSize;
uniform float uPixels;
uniform sampler2D uTexture;
out vec4 fragColor;
void main() {
vec2 uv = FlutterFragCoord().xy / uSize;
vec2 pixelatedUV = floor(uv * uPixels) / uPixels;
fragColor = texture(uTexture, pixelatedUV);
}
加载与应用
// Load asset
final program = await FragmentProgram.fromAsset('shaders/pixelate.frag');
// CustomPainter
void paint(Canvas canvas, Size size) {
final shader = program.fragmentShader();
shader.setFloat(0, size.width); // uSize.x
shader.setFloat(1, size.height); // uSize.y
shader.setFloat(2, 50.0); // uPixels (50x50 grid)
final paint = Paint()..shader = shader;
canvas.drawRect(Offset.zero & size, paint);
}
适用场景: 可扩展的企业级应用。
lib/
domain/ # 实体,仓库接口(纯 Dart)
entities/
repositories/
data/ # 实现(API,数据库)
datasources/
repositories/
models/ # DTOs
presentation/ # UI,控制器(Flutter)
pages/
widgets/
controllers/
适用场景: 将 API 与 UI 解耦。
@riverpod
AuthRepository authRepository(AuthRepositoryRef ref) {
return FirebaseAuthImpl(FirebaseAuth.instance);
}
@riverpod
Future<User> currentUser(CurrentUserRef ref) {
return ref.watch(authRepositoryProvider).getCurrentUser();
}
适用场景: 支持手机、平板和桌面。
class AdaptiveScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
final width = MediaQuery.of(context).size.width;
if (width > 900) {
return Row(children: [NavRail(), Expanded(child: Body())]);
} else {
return Scaffold(
drawer: Drawer(),
body: Body(),
bottomNavigationBar: BottomNavBar(),
);
}
}
}
openapi_generator 构建 Dart 客户端。.riv)→ Flutter 专家通过 rive 包集成。每周安装数
106
代码仓库
GitHub 星标数
45
首次出现
2026年1月24日
安全审计
安装于
opencode89
gemini-cli86
codex85
claude-code81
cursor80
github-copilot72
Provides cross-platform mobile development expertise specializing in Flutter 3+, Dart programming, and Riverpod state management. Builds high-fidelity applications for Mobile, Web, and Desktop with advanced rendering optimization (Impeller), custom render objects, and native integrations via FFI and Method Channels.
| Pattern | Best For | Complexity | Pros |
|---|---|---|---|
| Riverpod | Default Choice | Medium | Compile-time safety, no context dependency, testable. |
| BLoC/Cubit | Enterprise | High | Strict event/state separation, great for logging/analytics. |
| Provider | Legacy/Simple | Low | Built-in, simple, but relies on BuildContext. |
| GetX | Rapid MVP | Low | "Magic" reactive, less boilerplate, but non-standard patterns. |
How to talk to Native?
│
├─ **Method Channels (Standard)**
│ ├─ Async calls? → **MethodChannel**
│ └─ Streams? → **EventChannel**
│
├─ **FFI (High Performance)**
│ ├─ C/C++ Library? → **dart:ffi**
│ └─ Rust Library? → **Flutter Rust Bridge**
│
└─ **Platform Views (UI)**
├─ Native UI inside Flutter? → **AndroidView / UiKitView**
└─ Performance Critical? → **Hybrid Composition**
RepaintBoundary to isolate heavy paints (e.g., video players, rotating spinners).Red Flags → Escalate tomobile-developer (Native):
Goal: Create a visual effect (e.g., pixelation).
Steps:
Shader Code (shaders/pixelate.frag)
#include <flutter/runtime_effect.glsl>
uniform vec2 uSize;
uniform float uPixels;
uniform sampler2D uTexture;
out vec4 fragColor;
void main() {
vec2 uv = FlutterFragCoord().xy / uSize;
vec2 pixelatedUV = floor(uv * uPixels) / uPixels;
fragColor = texture(uTexture, pixelatedUV);
}
Load & Apply
// Load asset
final program = await FragmentProgram.fromAsset('shaders/pixelate.frag');
// CustomPainter
void paint(Canvas canvas, Size size) {
final shader = program.fragmentShader();
shader.setFloat(0, size.width); // uSize.x
shader.setFloat(1, size.height); // uSize.y
shader.setFloat(2, 50.0); // uPixels (50x50 grid)
final paint = Paint()..shader = shader;
canvas.drawRect(Offset.zero & size, paint);
}
Use case: Scalable enterprise apps.
lib/
domain/ # Entities, Repository Interfaces (Pure Dart)
entities/
repositories/
data/ # Implementations (API, DB)
datasources/
repositories/
models/ # DTOs
presentation/ # UI, Controllers (Flutter)
pages/
widgets/
controllers/
Use case: Decoupling API from UI.
@riverpod
AuthRepository authRepository(AuthRepositoryRef ref) {
return FirebaseAuthImpl(FirebaseAuth.instance);
}
@riverpod
Future<User> currentUser(CurrentUserRef ref) {
return ref.watch(authRepositoryProvider).getCurrentUser();
}
Use case: Supporting Phone, Tablet, and Desktop.
class AdaptiveScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
final width = MediaQuery.of(context).size.width;
if (width > 900) {
return Row(children: [NavRail(), Expanded(child: Body())]);
} else {
return Scaffold(
drawer: Drawer(),
body: Body(),
bottomNavigationBar: BottomNavBar(),
);
}
}
}
openapi_generator to build Dart clients..riv) → Flutter Expert integrates via rive package.Weekly Installs
106
Repository
GitHub Stars
45
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode89
gemini-cli86
codex85
claude-code81
cursor80
github-copilot72
Flutter 插件开发指南:从架构设计到 Android/Windows 平台实现
3,300 周安装