सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
Watch It एक हल्का राज्य प्रबंधन समाधान है जो Flutter के लिए get_it सेवा स्थापना का उपयोग करता है, जो पंजीकृत ऑब्जेक्ट में बदलाव को देखता है और जब इन बदलाव होते हैं तो UI को स्वचालित रूप से पुनर्निर्माण करता है। get_it के साथ निरंतर एकीकरण के कारण, यह जटिल बॉइलरप्लेट या अतिरिक्त विजेट्स के बिना राज्य अपडेट को सरल बनाता है। सेवा ऑब्जेक्ट्स से जुड़े प्रतिक्रियाशील व्यवहार की आवश्यकता वाले ऐप्स के लिए उपयुक्त, Watch It हस्तचालित राज्य प्रबंधन को कम करके साफ और बनाए रखने योग्य कोड को बढ़ावा देता है। यह सभी प्रमुख Flutter प्लेटफॉर्म का समर्थन करता है और get_it का उपयोग कर रहे प्रोजेक्ट्स में अच्छा काम करता है।
उपयोग
सेवा अवस्था के आधार पर प्रतिक्रियाशील UI अपडेट
छोटे से मध्यम आकार के एप्लिकेशन में राज्य प्रबंधन को सरल बनाना
निर्भरता-आधारित सेवाओं में परिवर्तनों की निगरानी करना
फॉर्म या सूचियों में रीयल-टाइम डेटा सिंक्रनाइजेशन
राज्य-संवेदनशील विजेट में बॉयलरप्लेट को कम करना
मुख्य विशेषताएँ
get_it पर आधारित
वस्तु परिवर्तनों पर स्वचालित UI पुनर्निर्माण
न्यूनतम सेटअप और एकीकरण
क्रॉस-प्लेटफ़ॉर्म समर्थन
अतिरिक्त अवस्था क्लासेस की आवश्यकता नहीं है
हल्का और तेज़
इनके लिए उपयुक्त
get_it का उपयोग करने वाले विकासकर्मी
सरल से मध्यम राज्य की आवश्यकता वाले प्रोजेक्ट
न्यूनतम राज्य प्रबंधन ओवरहेड की तलाश में टीमें
प्रतिक्रियाशील सेवा अद्यतन की आवश्यकता वाले ऐप
Flutter शुरुआती राज्य समाधानों का अन्वेषण कर रहे हैं
विचार योग्य बातें
गैर-जटिल राज्य परिदृश्य के लिए सबसे उपयुक्त
प्रोवाइडर या ब्लॉक जैसे पूर्ण राज्य प्रबंधन समाधान की जगह नहीं लेता है
प्रेक्षणीय ऑब्जेक्ट्स के सावधानीपूर्वक प्रबंधन की आवश्यकता होती है
विशेष अवस्था पुस्तकालयों की तुलना में सीमित डिबगिंग उपकरण
जटिल राज्य तर्क वाले बड़े पैमाने के एप्लिकेशन के लिए आदर्श नहीं है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
The easiest state management for Flutter built on get_it
Widgets automatically rebuild when data changes. No ValueListenableBuilder, no StreamBuilder, no FutureBuilder—just watch your data and your UI stays in sync.
One line instead of 12. No nesting, no boilerplate. Watch multiple values without builder hell.
Part of flutter_it — A construction set of independent packages. watch_it + get_it is the recommended foundation. Add command_it and listen_it when you need them.
Why watch_it?
✨ Zero Boilerplate — No Builders, no setState, no widget tree nesting
⚡ Automatic Cleanup — Subscriptions disposed automatically when widget destroys
🎯 Type Safe — Catch errors at compile time with generics
🔧 Flexible Data Types — Works with Listenable, ValueListenable, Stream, Future
📊 Multiple Watches — Watch 3+ values without pyramid of doom
🧪 Test Friendly — Easy to mock and inject dependencies
Watching objects created by cached factories with parameters
If you have one manager per entity (e.g. per station id), register it with registerCachedFactoryParam and pass the parameter to the watch function. When the parameter changes, watch_it automatically unsubscribes from the old instance and subscribes to the new one:
di.registerCachedFactoryParam<StationManager, String, void>(
(stationId, _) => StationManager(stationId),
);
classStationTileextendsWatchingWidget{
finalString stationId;
constStationTile({super.key, requiredthis.stationId});
@overrideWidgetbuild(BuildContext context) {
final name = watchValue((StationManager m) => m.name, param1: stationId);
returnText(name);
}
}
param1/param2 are available on all watch and handler functions that resolve their object from get_it. They are only valid for types registered with registerCachedFactoryParam. Plain registerFactory registrations can't be watched at all (every build would get a new instance) and are rejected in debug mode.
Lifecycle Helpers
Powerful functions for StatelessWidgets:
createOnce — Create objects on first build, auto-dispose on widget destroy
Built on get_it — watch_it is designed to work with get_it's service locator pattern. Register your models, services, and business logic with get_it, then watch them reactively.
// Register with get_it
di.registerLazySingleton(() => UserManager());
di.registerLazySingleton(() => TodoManager());
// Watch them in any widgetclassMyWidgetextendsWatchingWidget{
@overrideWidgetbuild(BuildContext context) {
final user = watchIt<UserManager>();
final todos = watchValue((TodoManager m) => m.todos);
returnListView(...);
}
}
Want more? Combine with other flutter_it packages:
get_it — Recommended pairing. Service locator for dependency injection. Access global services with di<T>().
Optional: command_it — Command pattern with loading/error states. Watch Commands reactively for automatic UI updates.
💡 flutter_it is a construction set — watch_it + get_it is the recommended foundation. Add command_it and listen_it when you need advanced features. Each package works independently.
This package ships an Agent Skill for AI coding assistants
(Claude Code, Cursor, GitHub Copilot, Codex, Gemini CLI and others) in skills/watch-it-expert/.
It teaches them the critical rules, common patterns and anti-patterns of watch_it.
Install it into your project with the official Dart skills tool:
dart run skills@ get
dart run skills@ get only looks at direct dependencies. If you use get_it through watch_it, add get_it to your pubspec as well to also get get-it-expert.
For the ecosystem-wide skills (architecture guidance, feed/data-source patterns, overview)
and the skills of the other flutter_it packages run: