Install any skill in seconds. Free to start, no credit card required.
Get Started Free →get-it-expert
Expert guidance on get_it service locator and dependency injection for Flutter/Dart. Covers registration (singleton, factory, lazy, async), scopes with shadowing, async initialization with init() pattern, retrieval, testing with scope-based mocking, and production patterns.
Passed 22 of 24 test cases with the skill, and 11 of 24 without it.
and 10 more in the full report
11 fixed11 passed either way2 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 11 test cases the skill fixed. Same model, same prompt, with and without the skill.
In my Dart application, the AnalyticsTracker service is only registered in release builds. In debug builds, calling getIt<AnalyticsTracker>() throws an exception. What GetIt method should I use to safely retrieve AnalyticsTracker returning null if it is missing?
| Checked | Without skill | With skill |
|---|---|---|
| Uses getIt.maybeGet<AnalyticsTracker>() | Missed | Passed |
The instructions your model reads when the skill loads.
What: Type-safe service locator with O(1) lookup. Register services globally, retrieve anywhere without BuildContext. Pure Dart, no code generation.
runApp()pushNewScope() is synchronous. Use pushNewScopeAsync() for async initpopScope() IS async (returns Future<void>)allReady() returns Future<void> - await it or use FutureBuilder/watch_itallReady()), access them with normal getIt<T>() - no getAsync neededdi alias for GetIt.I is already provided - use di<T>() instead of getIt<T>()registerLazySingleton<Iface>(getIt.call) re-enters get<Iface>(). Since 9.3.0 lazy singletons (sync/async) and cached factories throw a descriptive StateError for circular self-resolution instead of a StackOverflowError; plain factories are not guarded (recursive factories are legitimate). Use () => getIt<Impl>()final getIt = GetIt.instance;
void configureDependencies() {
// Singleton - created immediately
getIt.registerSingleton<ApiClient>(ApiClient());
// Singleton with dispose callback
getIt.registerSingleton<StreamController>(
StreamController(),
dispose: (c) => c.close(),
);
// Lazy singleton - created on first access
getIt.registerLazySingleton<Database>(() => Database());
// Factory - new instance every call
getIt.registerFactory<Logger>(() => Logger());
// Factory with parameters
getIt.registerFactoryParam<Logger, String, void>(
(tag, _) => Logger(tag),
);
test cases passed, vs 11 / 24 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.