Skip to content
Back to skills

Flutter Di Usage

ASecurity

Explain what the `flutter-di` plugin does and how to use it. Use when the user invokes `/flutter-di-usage`, asks what this plugin covers, or needs help registering or reading dependencies (Lean DI `Deps`/`DepsProvider`/`BlocDependency`, or `provider`), choosing dependency scope, or planning async initialization.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 25, 2026
ai-agents

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add leancodepl/ai-plugins --skill flutter-di-usage --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Flutter Di Usage?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Flutter Di Usage
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leancodepl-flutter-di-usage/badge)](https://www.skillsdirectory.com/skills/leancodepl-flutter-di-usage)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: flutter-di-usage
description: Explain what the `flutter-di` plugin does and how to use it. Use when the user invokes `/flutter-di-usage`, asks what this plugin covers, or needs help registering or reading dependencies (Lean DI `Deps`/`DepsProvider`/`BlocDependency`, or `provider`), choosing dependency scope, or planning async initialization.
---

# DI Usage

## How to respond

- If the user invoked this skill without a concrete task, start by explaining what this plugin does and when it should be used.
- Before writing or reviewing DI code, detect the project's DI mechanism as described in `references/dependency-injection.md`, then follow the matching reference. Do not migrate the project to the other mechanism or add a second one unless the user asks.
- Show how to use it through concrete DI tasks, especially wiring a page's dependencies and scope decisions.
- Point to the main rule here, or route to `flutter-bloc` when the task is really about cubit logic after dependencies are provided.
- If the user already gave a concrete DI task, briefly explain why this plugin fits and then do the work.
- Do not reply with filler like "skill loaded", "ready for the task", or "what would you like to do?" before explaining the plugin.

## What this plugin does

- Detects whether a Flutter project uses Lean DI (`lean_di`, `flutter_lean_di`, `flutter_lean_di_bloc`) or the `provider` package for dependency injection, and follows it.
- Lean DI: `Deps.global` with `DepsProvider.global`, page-scoped `DepsProvider`, `Dependency`, `ChangeNotifierDependency`, `Module`, `cacheKey`, reading with `context.get`/`watch`/`select`, and `BlocDependency` when the project uses `flutter_lean_di_bloc`.
- `provider`: provider scope, page-scoped dependencies with `BlocProvider`, and `GlobalProviders`.
- Covers creating dependency values directly in the registration's `create` function.
- Covers simple asynchronous global dependency initialization in `main()`.

## How to use it

- Ask to wire dependencies for a new page or feature.
- Ask whether a dependency should live at page scope or global scope.
- Ask to refactor a registration so values are created directly in `create`.
- Ask whether async setup belongs in `main()`.

## Example requests

- "Wire the dependencies for this booking page."
- "Register this cubit for the order page with `BlocDependency`."
- "Should this service live in `Deps.global` or stay local to the route?"
- "Should this service live in `GlobalProviders` or stay local to the route?"
- "Should this dependency be initialized in `main()` or provided later?"

## Reach for these assets

- `references/dependency-injection.md` - how to detect the project's DI mechanism, and the rules shared by both. Read it first.
- `references/lean-di.md` - Lean DI rules, for projects that depend on `lean_di`, `flutter_lean_di` or `flutter_lean_di_bloc`.
- `references/provider.md` - `provider` rules, for projects that use the `provider` package for DI.
- Related plugin: `flutter-bloc` - cubit/bloc state-management patterns after dependencies are provided.

Files in this skill

  • SKILL.md1.9 KB
  • references/dependency-injection.md751 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.