miniriverpod를 몇 분 안에 설치하세요.

단일 파일 코어와 얇은 Flutter 바인딩으로 구성된 경량 Riverpod 스타일 상태 관리 도구입니다.

요구 사항

프로젝트가 최소 SDK 및 Flutter 버전을 충족하는지 확인하세요.

Dart SDK

>=3.10.0 <4.0.0

Flutter

>=3.38.0

기존 프로젝트를 업그레이드하는 경우, 설치 명령을 실행하기 전에 SDK 제약을 업데이트하세요.

설치

Flutter CLI로 패키지를 추가하거나 pubspec을 수동으로 업데이트하세요.

CLI

flutter pub add miniriverpod

pubspec.yaml

# 의존성에 추가
dependencies:
  miniriverpod: ^0.0.1

첫 단계

ProviderScope를 연결하고 Provider를 선언한 뒤 UI에서 watch 하세요.

main.dart
// 1) ProviderScope로 앱을 감쌉니다
void main() {
  runApp(
    const ProviderScope(
      child: MyApp(),
    ),
  );
}

// 2) Provider 정의
final counterProvider = Provider<int>((ref) => 0);

// 3) UI에서 watch
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')),
    );
  }
}
Provider((ref) => ...) 는 동기식입니다.
AsyncProvider<T>((ref) async => ...) 는 Future 또는 Stream을 처리합니다.
UI에서는 WidgetRef.watch(provider)로 구독합니다.

다음 단계

사용 가이드

miniriverpod가 오버헤드 없이 Riverpod처럼 느껴지는 이유를 알아보세요.

가이드 열기

GitHub

리포지토리에서 소스, 변경 로그, 샘플을 확인하세요.

GitHub 열기

API Reference

Quickly lookup methods such as invalidate, refreshValue, keepAlive, and invoke.

Open API Reference