flutter-expertise
Installation
SKILL.md
Flutter Expertise
State Management (Riverpod / BLoC)
- Riverpod: Use
ConsumerWidgetorref.watchcarefully to limit widget rebuilds. Keep providers small and focused. - BLoC: Use
BlocBuilderwithbuildWhento prevent unnecessary rebuilds. Maintain distinct states (Loading, Success, Error).
// Riverpod Example
final counterProvider = StateProvider((ref) => 0);
class CounterText extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
// Only rebuilds when counterProvider changes
final count = ref.watch(counterProvider);
return Text('Count: $count');
}
}