โซลูชันจัดการสถานะแบบเบาสำหรับ Flutter

สัมผัสพลังของสถาปัตยกรรม reactive แบบ Riverpod โดยไม่ต้องพึ่ง code generation หรือ dependency หนัก

ไม่ใช้ Code Gen

เขียนคลาสและ provider ของ Dart ตามปกติ ไม่ต้องใช้ build_runner

เบามาก

ขนาดเล็กกว่า 50KB เหมาะกับแอปที่ต้องการประสิทธิภาพสูง

API คุ้นเคย

แรงบันดาลใจจากไวยากรณ์การอ่านสถานะของ Riverpod

ก้าวแรก

เรียนรู้การเชื่อม miniriverpod เข้ากับโปรเจกต์ Flutter ภายในไม่กี่นาที

การติดตั้ง

flutter pub add miniriverpod

คู่มือการใช้งาน

user_provider.dart
import 'package:flutter/widgets.dart';
import 'package:miniriverpod/miniriverpod.dart';

// 1) Wrap your app with ProviderScope
void main() {
  runApp(
    const ProviderScope(
      child: MyApp(),
    ),
  );
}

// 2) Define a Provider
final counterProvider = Provider<int>((ref) => 0);

// 3) Watch from UI
class MyApp extends ConsumerWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final count = ref.watch(counterProvider);
    return Directionality(
      textDirection: TextDirection.ltr,
      child: Center(child: Text('$count')),
    );
  }
}
หมายเหตุสำคัญ

ต่างจาก Riverpod ดั้งเดิม miniriverpod โฟกัสเฉพาะ Flutter และไม่รองรับโปรเจกต์ Dart แบบสแตนด์อโลน ทำให้เราตัด logic ภายในออกได้ถึง 70% เพื่อประสิทธิภาพ