पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv4.0.7

riverpod_annotation

riverpod_generator के लिए अनुमानों को उजागर करने वाला एक पैकेज

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
14.2 लाख
लाइक
181
Pub अंक
130

पैकेज इंस्टॉल करें

flutter pub add riverpod_annotation

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

riverpod_annotation एक कोड जनरेशन पैकेज है जो Flutter एप्लिकेशन में Riverpod प्रदाता बनाने को सुगम बनाने के लिए अनुमति देता है। यह riverpod_generator के साथ संयुक्त रूप से काम करता है, जो बॉइलरप्लेट कोड को स्वचालित रूप से उत्पन्न करता है, जिससे हाथ से काम करने और संभावित त्रुटियों की मात्रा कम हो जाती है। सरल अनुमतियों के उपयोग से डेवलपर्स अधिक कुशलता से राज्य प्रबंधन तरीके को परिभाषित कर सकते हैं, जिससे कोड की पठनीयता और रखरखाव में सुधार होता है। इस पैकेज को सभी प्रमुख प्लेटफॉर्म के लिए समर्थित किया गया है, जिससे यह क्रॉस-प्लेटफॉर्म विकास के लिए आदर्श है।

उपयोग

  • प्रदाता उत्पादन को स्वचालित करना
  • राज्य प्रबंधन सेटअप को सरल बनाना
  • Riverpod कोड में बॉयलरप्लेट कम करना
  • प्रकार सुरक्षित निर्भरता को सक्षम करें
  • बड़े पैमाने पर एप्लिकेशन आर्किटेक्चर का समर्थन करना

मुख्य विशेषताएँ

  • प्रदाता को परिभाषित करने के लिए अनुमति देने वाले टैग
  • riverpod_generator के साथ एकीकरण
  • प्रकार सुरक्षा बल प्रवर्तन
  • क्रॉस-प्लेटफॉर्म संगतता
  • न्यूनतम रनटाइम ओवरहेड

इनके लिए उपयुक्त

  • Riverpod का उपयोग करने वाले Flutter विकासकर्ता
  • कोड बनाए रखने के प्राथमिकता वाली टीमें
  • स्केलेबल राज्य प्रबंधन की आवश्यकता वाले परियोजनाएँ
  • कम बॉलरप्लेट कोड चाहने वाले डेवलपर्स
  • बहुप्लेटफॉर्म लक्षित ऐप्स

विचार योग्य बातें

  • riverpod_generator को शामिल करने की आवश्यकता है
  • कोड जनरेशन के लिए build_runner की आवश्यकता है
  • बिल्ड समय को थोड़ा बढ़ा सकता है
  • रनटाइम प्रदाता निर्माण के लिए उपयुक्त नहीं
  • सही अनुच्छेद के उपयोग पर निर्भर है

मूल 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

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 2 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट