flutter-dependency-injection
БесплатноБез исполняемых скриптовНе проверенStandards for automated service locator setup using injectable and get_it. Use when configuring dependency injection with injectable and get_it in Flutter…
от ComeOnOliver★ 67 звёзд на GitHubОб этом скилле
Dependency Injection
Priority: P1 (HIGH)
Automated class dependency management using get_it and injectable.
Structure
core/injection/
├── injection.dart # Initialization & setup
└── modules/ # Third-party dependency modules (Dio, Storage)
Implementation Guidelines
- Automated Registration: Use @injectable annotations; avoid manual registry calls.
- @LazySingleton: Default for repositories, services, and data sources (init on demand).
- Factory Registration: Use @injectable (Factory) for BLoCs to ensure state resets on every new instance/request. Do NOT use
@Singleton()for BLoCs. - Abstract Injection: Always register implementations as abstract interfaces (as: IService).
- Modules: Use @module for registering third-party instances (e.g., Dio, Hive,
SharedPreferences). - Constructor Injection: Use mandatory constructor parameters;
injectableresolves them automatically. - Test Mocks: Swap implementations in
setUpusing getIt.unregister() followed by getIt.registerLazySingleton(() => MockService()) .
Reference & Examples
For module configuration and initialization templates: See references/REFERENCE.md.
Anti-Patterns
- ❌
getIt<OrderRepository>()inside widgetbuild()— inject via constructor, not GetIt calls in UI - ❌
@Singleton()on a BLoC — BLoCs must use@injectable(Factory) so state resets per instance - ❌ Injecting the concrete class:
OrderRepositoryImpl repo— always inject the abstract interface - ❌
getIt.registerLazySingleton<X>(() => X())in production code — use@injectableannotations; manual registration is only for tests
Related Topics
layer-based-clean-architecture | testing
Установить flutter-dependency-injection в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл flutter-dependency-injection?
Standards for automated service locator setup using injectable and get_it. Use when configuring dependency injection with injectable and get_it in Flutter. (triggers: **/injection.dart, **/locator.dart, GetIt, injectable, singleton, module, lazySingleton, factory)
Как установить скилл flutter-dependency-injection?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл flutter-dependency-injection запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic