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

पैकेज विवरणv2.3.0

vxstate

VxState फ्लटर के लिए एक अन्य राज्य प्रबंधन समाधान है। यह Redux और VueX से बहुत प्रभावित है।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
5.8 हज़ार
लाइक
31
Pub अंक
160

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

flutter pub add vxstate

पैकेज अवलोकन

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

VxState एक फ्लटर के लिए राज्य प्रबंधन समाधान है, जो रेडुक्स और व्यूएक्स से प्रेरित है। यह एक भविष्यवाणी योग्य, केंद्रीकृत स्टोर प्रदान करता है जो एप्लिकेशन राज्य को एक दिशात्मक डेटा फ्लो के साथ प्रबंधित करता है। इसकी विस्तारशीलता और सरलता के लिए डिज़ाइन किया गया है, यह प्रतिक्रियाशी अपडेट्स का समर्थन करता है और फ्लटर के विजेट ट्री के साथ अच्छी तरह से एकीकृत होता है। VxState संक्षिप्त एपीआई और स्थिर पैटर्न के माध्यम से स्पष्ट आर्किटेक्चर और डेवलपर अनुभव पर जोर देता है। यह एंड्रॉइड, आईओएस, वेब, मैकओएस, विंडोज और लिनक्स सहित सभी प्रमुख प्लेटफॉर्म पर काम करता है।

उपयोग

  • ग्लोबल ऐप स्टेट का प्रबंधन
  • पूर्वानुमानित अवस्था परिवर्तन कार्यान्वयन
  • बड़े Flutter एप्लिकेशन को स्केल करना
  • प्रतिक्रियाशील उपयोगकर्ता इंटरफेस के साथ एकीकरण
  • जटिल राज्य तर्क को सरल बनाना
  • क्रॉस-प्लेटफॉर्म एप्लिकेशन का समर्थन करना

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

  • Redux-जैसा एकदिशा डेटा प्रवाह
  • VueX-आधारित स्टोर संरचना
  • प्रतिक्रियाशील राज्य अद्यतन
  • क्रॉस-प्लेटफॉर्म संगतता
  • स्पष्ट और निर्मल API
  • निर्मित डेवलपमेंट टूल समर्थन

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

  • Redux या VueX के साथ परिचित विकासकर्ता
  • बड़े पैमाने पर Flutter ऐप बनाने वाली टीमें
  • पूर्वानुमानित राज्य प्रबंधन की आवश्यकता वाले प्रोजेक्ट
  • ताकतवर डिबगिंग क्षमता की आवश्यकता वाले ऐप्स
  • सुसंगतता और संरचना की महत्व देने वाले विकासकर्ता

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

  • शुरुआती लोगों के लिए शायद एक बड़ा सीखने का वक्र हो सकता है
  • राज्य पैटर्न के बारे में समझ की आवश्यकता है
  • बहुत सरल ऐप्स के लिए अत्यधिक उपयोगी
  • लोकप्रिय विकल्पों की तुलना में सीमित समुदाय संसाधन
  • प्रोवाइडर या रिवरपॉड की तुलना में कम लोकप्रिय है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

VxState

VxState is a state management library built for Flutter apps with focus on simplicity. It is inspired by StoreKeeper & libraries like Redux, Vuex etc with the power of streams. Here is a basic idea of how it works:

  • Single Store (Single source of truth) to keep app's data
  • Structured modifications to store with Mutations
  • Widgets listen to mutations to rebuild themselves
  • Enhance this process with Interceptors and Effects

Core of VxState is based on the InheritedModel widget from Flutter.

Getting started

Add to your pubpsec:

dependencies:
  ...
  vxstate: any

Create a store:

import 'package:vxstate/vxstate.dart';

class MyStore extends VxStore {
  int count = 0;
}

Define mutations:

class Increment extends VxMutation<MyStore> {
  perform() => store.count++;
}

Listen to mutations:

@override
Widget build(BuildContext context) {
  // Define when this widget should re render
  VxState.watch(context, on: [Increment]);

  // Get access to the store
  MyStore store = VxState.store as MyStore;

  return Text("${store.count}");
}

Complete example:

import 'package:flutter/material.dart';
import 'package:vxstate/vxstate.dart';

// Build store and make it part of app
void main() {
  runApp(VxState(
    store: MyStore(),
    child: MyApp(),
  ));
}

// Store definition
class MyStore extends VxStore {
  int count = 0;
}

// Mutations
class Increment extends VxMutation<MyStore> {
  perform() => store.count++;
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // Define when this widget should re render
    VxState.watch(context, on: [Increment]);

    // Get access to the store
    MyStore store = VxState.store as MyStore;

    return MaterialApp(
      home: Scaffold(
        body: Column(
          children: <Widget>[
            Text("Count: ${store.count}"),
            RaisedButton(
              child: Text("Increment"),
              onPressed: () {
                // Invoke mutation
                Increment();
              },
            ),
          ],
        ),
      ),
    );
  }
}

Documentation

  • VxStore - Where your apps's data is kept
  • VxMutation - Logic that modifies Store
  • VxBuilder, VxNotifier, VxConsumer - Useful widgets for special cases
  • VxEffect - Chained mutations
  • VxInterceptors - Intercept execution of mutations

श्रेणियाँ

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

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