power_state
डिपेंडेंस इंजेक्शन के साथ एक Flutter राज्य प्रबंधन समाधान। आप अपने राज्य को आसानी से प्रबंधित कर सकते हैं
एक फ्लटर अवस्था प्रबंधन समाधान।
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
Power State is a lightweight and flexible state management library for Flutter apps. It provides a simple and easy-to-use API that helps you manage the state of your app in a clean and efficient way. With Power State, you can easily manage your app's state and update your UI in real-time.
Create a controller class that extends PowerController. This controller class will hold your application's state and provide methods to manipulate it.
Here's an example CounterController class:
import 'package:power_state/power_state.dart';
class CounterController extends PowerController {
int count = 1;
increment() {
count++;
notifyListeners();
}
}
Instantiate your controller class using PowerVault.put() method:
final CounterController controller = PowerVault.put(CounterController());
Use PowerBuilder to listen for changes to your state and rebuild your UI. Use PowerSelector to select a specific value from your state and rebuild only when that value changes.:
PowerBuilder<CounterController>(
builder: (countController) {
return Text(countController.count.toString());
},
),
PowerSelector<CounterController>(
selector: () => controller.selectorValue,
builder: (countController) {
return Text(countController.selectorValue.toString());
},
),
Update your state by calling methods on your controller and calling notifyListeners() to rebuild your UI.
controller.increment();
controller.update();
You can find a Controller that is being used by another page and redirect you to it.
final CounterController countController = PowerVault.find();
If you no longer need a controller, you can delete it from PowerVault using the PowerVault.delete() method. Here's an example of deleting the CounterController:
PowerVault.delete<CounterController>();
If you no longer need controllerr, you can delete it from PowerVault using the PowerVault.clear() method. Here's an example of clear controllers:
PowerVault.clear();
Check out the example app to see Power State in action.
निर्भरता सूची 3 आइटम
{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗