get-it-expert
Installation
SKILL.md
get_it Expert - Service Locator & Dependency Injection
What: Type-safe service locator with O(1) lookup. Register services globally, retrieve anywhere without BuildContext. Pure Dart, no code generation.
CRITICAL RULES
- Register all services BEFORE
runApp() pushNewScope()is synchronous. UsepushNewScopeAsync()for async initpopScope()IS async (returnsFuture<void>)allReady()returnsFuture<void>- await it or use FutureBuilder/watch_it- Dispose callbacks are a parameter on registration methods, not separate methods
- Once async singletons are initialized (after
allReady()), access them with normalgetIt<T>()- nogetAsyncneeded - If using watch_it, a global
dialias forGetIt.Iis already provided - usedi<T>()instead ofgetIt<T>()
Registration
final getIt = GetIt.instance;
Related skills