Agent skill

Unyo Dependency Injection

by K3vinb5 in K3vinb5/unyo-app

How to register and resolve dependencies using GetIt in the Unyo Flutter app.

BSD-3-ClauseAuto-check passedDevelopment

Install Unyo Dependency Injection

skills CLI
$ npx skills add K3vinb5/unyo-app --skill unyo-dependency-injection -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install K3vinb5/unyo-app unyo-dependency-injection --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/K3vinb5/unyo-app.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/unyo-dependency-injection .claude/skills/unyo-dependency-injection && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
unyo-dependency-injection
GitHub stars
664
Token cost
~2.4k tokens
SKILL.md length
615 words
Files
1
Skills in repo
7
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

How to register and resolve dependencies using GetIt in the Unyo Flutter app.

  • Works in 2 steps: setupLocator() — Called before runApp() → setupLocatorAfterHiveInit() — Called…
  • Adding new services
  • SKILL.md covers The Service Locator, Two-Phase Initialization, Registration Types and Named Instances, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Unyo Dependency Injection is an agent skill from K3vinb5/unyo-app. How to register and resolve dependencies using GetIt in the Unyo Flutter app. Use this skill whenever adding new services, repositories, cubits, or notifiers to the dependency injection container, understanding registration types (singleton vs factory vs lazySingleton), dealing with named instances, or debugging DI-related errors like "Object not found" or circular dependencies.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Design patterns. It works with Flutter. The repository describes itself as: 🐙 Anime streaming and Manga reader desktop app without ads. The licence is BSD-3-Clause.

When your agent uses it

  • Adding new services
  • Notifiers to the dependency injection container
  • Understanding registration types (singleton vs factory vs lazySingleton)
  • Dealing with named instances

Example prompts

  • “Object not found”
  • “/unyo-dependency-injection”

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. setupLocator() — Called before runApp()
  2. setupLocatorAfterHiveInit() — Called after Hive initializes

What it can do on your machine

Read from SKILL.md and the folder at commit 0a44722. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are dart).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Unyo Dependency Injection loads about 2.4k tokens when it runs. Until then it costs about 102 tokens; SKILL.md has 615 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~102
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from K3vinb5/unyo-app at commit 0a44722, republished under its BSD-3-Clause licence (© K3vinb5). 615 words, ~2,407 tokens.

Download SKILL.mdSave it as .claude/skills/unyo-dependency-injection/SKILL.md (or your agent's skills folder).
name
unyo-dependency-injection
description
How to register and resolve dependencies using GetIt in the Unyo Flutter app. Use this skill whenever adding new services, repositories, cubits, or notifiers to the dependency injection container, understanding registration types (singleton vs factory vs lazySingleton), dealing with named instances, or debugging DI-related errors like "Object not found" or circular dependencies.

Unyo Dependency Injection with GetIt

Unyo uses GetIt as its service locator for dependency injection. All registrations happen in a single file (lib/core/di/locator.dart) and follow a clear two-phase initialization pattern.

The Service Locator

dart
// lib/core/di/locator.dart
final sl = GetIt.instance;

sl is the global service locator instance used throughout the app. Every dependency — services, repositories, notifiers, cubits — is registered in and resolved from sl.

Two-Phase Initialization

Unyo initializes dependencies in two phases because some services depend on asynchronous platform APIs (like getApplicationSupportDirectory()) and others depend on Hive being ready.

Phase 1: setupLocator() — Called before runApp()
dart
void setupLocator() async {
  // 1. Async platform dependencies first
  sl.registerSingletonAsync<Directory>(
    () => getApplicationSupportDirectory(),
    instanceName: config.applicationSupportDirectory,
  );
  await sl.isReady<Directory>(instanceName: config.applicationSupportDirectory);

  // 2. Singletons with no async dependencies
  sl.registerSingleton<Logger>(getLogger());
  sl.registerSingleton<AniyomiBridge>(AniyomiBridge());
  sl.registerSingleton<TorrentService>(TorrentService());
  sl.registerSingleton<SettingsService>(SettingsService());

  // 3. Lazy singletons (services, notifiers, repositories)
  sl.registerLazySingleton<HttpService>(() => HttpService());
  sl.registerLazySingleton<GraphQLService>(
    () => GraphQLService(httpService: sl<HttpService>(), endpoint: config.anilistGraphQLEndpoint),
    instanceName: config.anilistGraphQlService,
  );
  sl.registerLazySingleton<AppEffectHandler>(() => AppEffectHandler());

  // 4. Notifiers (all lazy singletons)
  sl.registerLazySingleton<AnimeNotifier>(() => AnimeNotifier());
  sl.registerLazySingleton<MangaNotifier>(() => MangaNotifier());
  // ... more notifiers

  // 5. Repositories (lazy singletons)
  sl.registerLazySingleton<AnimeRepositoryAnilist>(() => AnimeRepositoryAnilist());
  sl.registerLazySingleton<MangaRepositoryAnilist>(() => MangaRepositoryAnilist());

  // 6. Cubits (factories — new instance each time)
  sl.registerFactory<HomeCubit>(() => HomeCubit(
    sl<UserNotifier>(instanceName: config.loggedUserNotifier),
    sl<AnimeNotifier>(),
    sl<MangaNotifier>(),
    // ... all dependencies
  ));
}
Phase 2: setupLocatorAfterHiveInit() — Called after Hive initializes
dart
void setupLocatorAfterHiveInit() {
  // Dependencies that require Hive to be ready
  sl.registerSingleton<ExtensionRepositoryAniyomi>(
    ExtensionRepositoryAniyomi(
      sl<UserRepositoryAnilist>(),
      sl<UserNotifier>(instanceName: config.loggedUserNotifier),
    ),
  );
}

Why two phases? ExtensionRepositoryAniyomi uses Hive boxes for storage, so it can't be constructed until after Hive is initialized. The main() function calls setupLocator() → Hive init → setupLocatorAfterHiveInit().

Registration Types

registerSingleton<T> — Eager, one instance forever
dart
sl.registerSingleton<Logger>(getLogger());
  • Created immediately at registration time
  • Same instance returned for every sl<Logger>() call
  • Use for: Logger, platform services, anything needed ASAP
registerLazySingleton<T> — Lazy, one instance forever (after first access)
dart
sl.registerLazySingleton<AnimeRepositoryAnilist>(() => AnimeRepositoryAnilist());
  • Created only when first accessed via sl<AnimeRepositoryAnilist>()
  • Same instance for all subsequent calls
  • Use for: Repositories, notifiers, services — things that are heavy or may not always be needed
registerFactory<T> — New instance every time
dart
sl.registerFactory<HomeCubit>(() => HomeCubit(
  sl<UserNotifier>(instanceName: config.loggedUserNotifier),
  sl<AnimeNotifier>(),
));
  • Factory function runs every time sl<HomeCubit>() is called
  • Each call gets a fresh instance
  • Use for: Cubits — each screen gets its own cubit instance
registerSingletonAsync<T> — Async eager singleton
dart
sl.registerSingletonAsync<Directory>(
  () => getApplicationSupportDirectory(),
  instanceName: config.applicationSupportDirectory,
);
await sl.isReady<Directory>(instanceName: config.applicationSupportDirectory);
  • Created asynchronously
  • Must await isReady<T>() before using
  • Use for: Platform dependencies that return Futures

Named Instances

When you need multiple registrations of the same type, use named instances:

dart
// In config.dart
const String loggedUserNotifier = 'loggedUserNotifier';
const String newUserNotifier = 'newUserNotifier';

// Registration
sl.registerLazySingleton<UserNotifier>(() => UserNotifier(), instanceName: config.loggedUserNotifier);
sl.registerLazySingleton<UserNotifier>(() => UserNotifier(), instanceName: config.newUserNotifier);

// Resolution
sl<UserNotifier>(instanceName: config.loggedUserNotifier)  // Different instance
sl<UserNotifier>(instanceName: config.newUserNotifier)      // Different instance

Convention: Store instance name strings as const in lib/config/config.dart, not as magic strings in the locator.

Adding a New Dependency: Complete Workflow

Example: Adding a new StudioNotifier and StudioRepository
  1. Create config constants (if adding named instances):
dart
// lib/config/config.dart
const String studioNotifier = 'studioNotifier';
  1. Register in setupLocator() in the correct section:
dart
// Notifiers section
sl.registerLazySingleton<StudioNotifier>(() => StudioNotifier());

// Repositories section
sl.registerLazySingleton<StudioRepositoryAnilist>(() => StudioRepositoryAnilist());

// Cubits section (factories!)
sl.registerFactory<StudioCubit>(() => StudioCubit(
  sl<StudioNotifier>(),
  sl<StudioRepositoryAnilist>(),
));
  1. If the dependency needs Hive, register in setupLocatorAfterHiveInit() instead.

  2. Import the cubit/notifier in locator.dart:

dart
import 'package:unyo/application/cubits/studio_cubit.dart';
import 'package:unyo/core/notification/studio_notifier.dart';
  1. Use in screens via BlocProvider:
dart
// In the screen widget
BlocProvider(
  create: (context) => sl<StudioCubit>(),
  child: const StudioListener(),
)

Registration Order Matters

GetIt resolves dependencies at construction time. If HomeCubit needs AnimeNotifier, then AnimeNotifier must be registered before HomeCubit. Within each phase, follow this order:

  1. Platform dependencies (async singletons like Directory)
  2. Core singletons (Logger, bridge services)
  3. Services (HttpService, GraphQLService, TorrentService)
  4. Singletons depending on services (ThemeService, SettingsService)
  5. Notifiers (all lazy singletons)
  6. Repositories (lazy singletons that depend on services)
  7. Cubits (factories that depend on everything above)
Show full SKILL.md (249 more words)Show less

Dependency Injection in Repositories

Repositories access services via the locator, not constructor injection:

dart
class AnimeRepositoryAnilist with RepositoryMixin implements AnimeRepository {
  final GraphQLService _anilistGraphQLService = sl<GraphQLService>(
    instanceName: config.anilistGraphQlService,
  );
  final Logger _logger = sl<Logger>();

This is intentional — repositories are lazy singletons that only exist once, so direct locator access is simpler than threading services through constructors. Cubits, however, receive all their dependencies via constructor injection from the locator.

Common Pitfalls

  • Registering after resolution: GetIt throws at runtime if you try to resolve a type that hasn't been registered. Always add new registrations to setupLocator() before any code that uses sl<T>().
  • Missing await sl.isReady<T>(): For async singletons, you must wait for readiness before using them. The main() function handles this, but if you add a new async singleton, make sure to add the await.
  • Using registerFactory for notifiers: Notifiers must be registerLazySingleton so all cubits share the same stream. Using registerFactory would create separate instances, breaking cross-cubit communication.
  • Using registerSingleton for cubits: Cubits must be registerFactory to ensure each screen gets its own instance. Using registerSingleton would share state between screens and cause bugs.
  • Missing named instance on resolution: If you register with instanceName, you must also resolve with the same instanceName:
    dart
    // WRONG — resolves the unnamed instance, not the logged user notifier
    sl<UserNotifier>()
    // CORRECT — resolves the named instance
    sl<UserNotifier>(instanceName: config.loggedUserNotifier)
  • Circular dependencies: If A needs B and B needs A, GetIt can't resolve them. Break the cycle by using lazy resolution: pass a factory function instead of the actual instance.

Cross-references

  • Notifier pattern details: See unyo-reactive-notifiers skill
  • Cubit registration and wiring: See unyo-bloc-state-management skill
  • Repository pattern details: See unyo-domain-data-layer skill

© K3vinb5, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/unyo-dependency-injection of K3vinb5/unyo-app.

Open the folder on GitHubat commit 0a44722

Compare with similar skills

Unyo Dependency Injection next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Unyo Dependency Injection compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Unyo Dependency Injection this skillK3vinb5/unyo-app664—~2.4kAutomated safety check: PassBSD-3-Clause
Flutter App Architectureevanca/flutter-ai-rules650—~1.7kAutomated safety check: PassMIT
Architecture Feature Firstevanca/flutter-ai-rules650—~1.9kAutomated safety check: PassMIT
Flutter Initbear2u/my-skills932—~2.5kAutomated safety check: PassNone
Flutter Appccplugins/awesome-claude-code-plugins970—~1.1kAutomated safety check: NotesApache-2.0
Flutter Dependency InjectionHoangNguyen0403/agent-skills-standard572—~589Automated safety check: PassMIT

Similar skills

  • Flutter App Architecture

    evanca/flutter-ai-rules

    A skill your agent uses when scaffolding a project, refactoring into layers, creating view models/repositories, configuring dependency injection, or implementing unidirectional data flow (MVVM).

    650 GitHub stars~1.7k tokensUpdated 26 days ago
    DevelopmentAuto-check passed
  • Architecture Feature First

    evanca/flutter-ai-rules

    A skill your agent uses when creating a feature, designing folder structure, adding repositories/services/view models, wiring dependency injection, or deciding which layer owns logic.

    650 GitHub stars~1.9k tokensUpdated 26 days ago
    MobileAuto-check passed
  • Flutter Init

    bear2u/my-skills

    A skill your agent uses when user wants to create a new Flutter project (Todo/Habit/Note/Expense/Custom domain) with Clean Architecture, Riverpod 3.0, Drift, and modern Flutter stack

    932 GitHub stars~2.5k tokensUpdated 3 mo ago
    MobileAuto-check passed
  • Flutter App

    ccplugins/awesome-claude-code-plugins

    Bootstrap a new Flutter mobile app with clean architecture, Riverpod, FVM-pinned SDK, current packages, and no deprecated APIs.

    970 GitHub stars~1.1k tokensUpdated 1 mo ago
    MobileAuto-check: notes
  • Flutter Dependency Injection

    HoangNguyen0403/agent-skills-standard

    Configure service locator setup using injectable and getit in Flutter.

    572 GitHub stars~589 tokensUpdated yesterday
    MobileAuto-check passed
  • Flutter Feature Based Clean Architecture

    HoangNguyen0403/agent-skills-standard

    Organize Flutter apps with modular feature-based clean architecture.

    572 GitHub stars~663 tokensUpdated yesterday
    MobileAuto-check passed

More from K3vinb5/unyo-app

  • Generate Dart bean classes from JSON and regenerate serialization helpers using the fjson CLI.

    664 GitHub stars~2.2k tokensUpdated 4 mo ago
    Auto-check passed
  • How to create cubits, define states, use the EffectMixin pattern, and handle side effects in the Unyo Flutter app.

    664 GitHub stars~3.2k tokensUpdated 4 mo ago
    Auto-check passed
  • Unyo Domain Data Layer

    K3vinb5/unyo-app

    How to create domain entities, data models, and repositories in the Unyo Flutter app.

    664 GitHub stars~2.9k tokensUpdated 4 mo ago
    Auto-check passed
  • Unyo Reactive Notifiers

    K3vinb5/unyo-app

    How to create and use RxDart BehaviorSubject notifiers for cross-cubit communication in the Unyo Flutter app.

    664 GitHub stars~2.8k tokensUpdated 4 mo ago
    Auto-check passed
  • Unyo Routing Navigation

    K3vinb5/unyo-app

    How to add routes, configure navigation, and use AutoRoute in the Unyo Flutter app.

    664 GitHub stars~2.5k tokensUpdated 4 mo ago
    Auto-check passed
  • Unyo UI Presentation

    K3vinb5/unyo-app

    How to build screens, widgets, and handle effects in the Unyo Flutter app's presentation layer.

    664 GitHub stars~3k tokensUpdated 4 mo ago
    Auto-check passed

Works with

Categories

Questions about Unyo Dependency Injection

What does Unyo Dependency Injection do?

How to register and resolve dependencies using GetIt in the Unyo Flutter app. Unyo Dependency Injection is an agent skill from K3vinb5/unyo-app. How to register and resolve dependencies using GetIt in the Unyo Flutter app.

When should I use Unyo Dependency Injection?

Unyo Dependency Injection fits situations like: adding new services; notifiers to the dependency injection container; understanding registration types (singleton vs factory vs lazySingleton); dealing with named instances.

How do I install Unyo Dependency Injection in Claude Code?

Run `npx skills add K3vinb5/unyo-app --skill unyo-dependency-injection -a claude-code`. Or copy the skill folder (.agents/skills/unyo-dependency-injection in K3vinb5/unyo-app) into .claude/skills/unyo-dependency-injection in your project. Claude Code loads it when a task matches its description.

How do I install Unyo Dependency Injection in Codex?

Run `npx skills add K3vinb5/unyo-app --skill unyo-dependency-injection -a codex`. Or copy the skill folder (.agents/skills/unyo-dependency-injection in K3vinb5/unyo-app) into .agents/skills/unyo-dependency-injection in your project. Codex loads it when a task matches its description.

Can I use Unyo Dependency Injection in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add K3vinb5/unyo-app --skill unyo-dependency-injection -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/unyo-dependency-injection, .gemini/skills/unyo-dependency-injection, .github/skills/unyo-dependency-injection and .opencode/skills/unyo-dependency-injection in your project.

What does Unyo Dependency Injection need to run?

SKILL.md names no scripts, command-line tools or credentials: Unyo Dependency Injection is instructions for the agent only.

Does Unyo Dependency Injection access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Unyo Dependency Injection safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Unyo Dependency Injection use?

Unyo Dependency Injection is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Unyo Dependency Injection use?

About 2.4k tokens (SKILL.md is roughly 9.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Unyo Dependency Injection?

Skills that share tags, products or a category with Unyo Dependency Injection: Flutter App Architecture (evanca/flutter-ai-rules, 650 stars), Architecture Feature First (evanca/flutter-ai-rules, 650 stars), Flutter Init (bear2u/my-skills, 932 stars) and Flutter App (ccplugins/awesome-claude-code-plugins, 970 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Unyo Dependency Injection?

K3vinb5 (a GitHub user) maintains it in K3vinb5/unyo-app, which has 664 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on June 12, 2026.

Source: K3vinb5/unyo-app on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.