패키지, 저장소 및 앱 카테고리 검색

패키지 상세v3.5.0

flutter_riverpod

반응형 캐싱 및 데이터 바인딩 프레임워크입니다. Riverpod은 비동기 코드 작업을 쉽게 만듭니다.

AndroidiOSmacOSWindowsLinux
30일 다운로드
437만
좋아요
2.9천
Pub 점수
140

패키지 설치

flutter pub add flutter_riverpod

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutter Riverpod은 Flutter용으로 설계된 강력하고 반응형 상태 관리 및 종속성 주입 프레임워크입니다. 비동기 작업 처리를 간소화하고 내장 캐시를 통해 효율적인 데이터 바인딩을 제공합니다. Riverpod은 로직과 위젯을 분리하여 테스트 가능성과 유지보수성을 높입니다. 유연한 제공자 시스템은 다양한 데이터 유형과 수명 주기 관리를 지원하며 확장 가능한 애플리케이션에 적합합니다. 모든 주요 플랫폼에서 강력한 지원을 제공하여 개발 생산성과 앱 성능을 향상시킵니다.

사용 사례

  • 복잡한 앱 상태 관리
  • 비동기 데이터 스트림 처리
  • 대규모 앱에서의 의존성 주입
  • 상태 있는 로직 테스트
  • 반응형 UI 업데이트

주요 기능

  • 반응형 데이터 바인딩
  • 내장 캐싱
  • 비동기 지원
  • 테스트 가능한 제공자
  • 플랫폼 독립적 설계

적합한 대상

  • 대규모 플러터 애플리케이션
  • 테스트 가능성에 중점을 둔 팀
  • 중량 비동기 워크플로우를 가진 앱
  • 클린 아키텍처를 찾는 개발자
  • 의존성 주입이 필요한 프로젝트

고려 사항

  • 초보자를 위한 학습 곡선이 더 가파릅니다
  • 프로바이더 패턴에 대한 이해가 필요합니다
  • 간단한 앱에서 오버헤드를 유발할 수 있습니다
  • 다른 대안들에 비해 문서가 제한적
  • 이전 상태 솔루션에서의 마이그레이션이 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Build Status codecov Star on Github License: MIT Discord

Deploys by Netlify

Riverpod


A reactive caching and data-binding framework. https://riverpod.dev Riverpod makes working with asynchronous code a breeze by:

  • Handling errors/loading states by default. No need to manually catch errors
  • Natively supporting advanced scenarios, such as pull-to-refresh
  • Separating the logic from your UI
  • Ensuring your code is testable, scalable and reusable
riverpod pub package
flutter_riverpod pub package
hooks_riverpod pub package

Welcome to Riverpod (anagram of Provider)!

For learning how to use Riverpod, see its documentation: >>> https://riverpod.dev <<<

Long story short:

  • Define network requests by writing a function annotated with @riverpod:

    @riverpod
    Future<String> boredSuggestion(Ref ref) async {
      final response = await http.get(
        Uri.https('boredapi.com', '/api/activity'),
      );
      final json = jsonDecode(response.body);
      return json['activity']! as String;
    }
    
  • Listen to the network request in your UI and gracefully handle loading/error states.

    class Home extends ConsumerWidget {
      @override
      Widget build(BuildContext context, WidgetRef ref) {
        final boredSuggestion = ref.watch(boredSuggestionProvider);
        // Perform a switch-case on the result to handle loading/error states
        return switch (boredSuggestion) {
          AsyncData(:final value) => Text('data: $value'),
          AsyncError(:final error) => Text('error: $error'),
          _ => const Text('loading'),
        };
      }
    }
    

Contributing

Contributions are welcome!

Here is a curated list of how you can help:

  • Report bugs and scenarios that are difficult to implement
  • Report parts of the documentation that are unclear
  • Fix typos/grammar mistakes
  • Update the documentation or add examples
  • Implement new features by making a pull-request

Sponsors

카테고리

의존성

의존성 목록 5 개

소스 저장소

이 패키지를 사용하는 프로젝트