> 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)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/flutter-dependency-injection?format=md"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
@injectableannotations; avoid manual registry calls. - @LazySingleton: Default for repositories, services, and data sources (init on demand).
- @injectable (Factory): Default for BLoCs to ensure state resets on every request.
- Abstract Injection: Always register implementations as abstract interfaces (
as: IService). - Modules: Use
@modulefor registering third-party instances (e.g.,Dio,SharedPreferences). - Constructor Injection: Use mandatory constructor parameters;
injectableresolves them. - Test Mocks: Swap implementations in
setUpusinggetIt.registerLazySingletonfor testing.
Reference & Examples
For module configuration and initialization templates: See references/REFERENCE.md.
Related Topics
layer-based-clean-architecture | testing
🚫 Anti-Patterns
- Do NOT use standard patterns if specific project rules exist.
- Do NOT ignore error handling or edge cases.
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)