Flutter Retrofit NetworkingSAFE
A collection of Agent Skills Standard and Best Practice for Programming Languages, Frameworks that help our AI Agent follow best practies on frameworks and programming laguages
Overview
A collection of Agent Skills Standard and Best Practice for Programming Languages, Frameworks that help our AI Agent follow best practies on frameworks and programming laguages
6f5be687a268OBSERVED · 2026-10-14What it tells the agent
The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.
---
name: flutter-retrofit-networking
description: Build type-safe HTTP networking with Dio and Retrofit including auth interceptors in Flutter. Use when integrating REST APIs with Dio or Retrofit.
metadata:
triggers:
files:
- '**/data_sources/**'
- '**/api/**'
keywords:
- Retrofit
- Dio
- RestClient
- GET
- POST
- Interceptor
- refreshing
---
# Retrofit & Dio Networking
## **Priority: P0 (CRITICAL)**
## Structure
```text
infrastructure/
├── data_sources/
│ ├── remote/ # Retrofit abstract classes
│ └── local/ # Cache/Storage
└── network/
├── dio_client.dart # Custom Dio setup
└── interceptors/ # Auth, Logging, Cache
```
## Implementation Workflow
1. **Define Retrofit clients** — Create abstract classes with `@RestApi()` and HTTP annotations (`@GET`, `@POST`). Methods return `Future<DTO>`.
2. **Create DTOs** — Use `@freezed` and `@JsonSerializable` for all request/response bodies.
3. **Map to domain** — Data sources must map DTOs to Domain Entities (e.g., `userDto.toDomain()`).
4. **Guard enums** — Always use `@JsonKey(unknownEnumValue: Status.unknown)` to prevent crashes from new backend values.
5. **Add auth interceptor** — Inject `Authorization: Bearer <token>` in `onRequest`.
6. **Handle token refresh** — On 401, lock Dio, call `refreshToken()`, update stored token, retry via `dio.fetch(err.requestOptions)`.
7. **Map failures** — Convert `DioException` to typed `Failure` objects (ServerFailure, NetworkFailure).
### Retrofit Client & Safe Enum DTO Examples
See [implementation examples](references/implementation.md) for RestClient definitions and safe enum DTO patterns.
## Anti-Patterns
- **No Manual JSON Parsing**: Use Retrofit's generated mappers instead of `jsonDecode`
- **No Global Dio Instances**: Inject `Dio` through DI
- **No Inline Try-Catch**: repository layer should handle all Retrofit exceptions
- **No Unguarded Enums**: Always include `unknownEnumValue` to prevent crashes on new backend values
## Reference & Examples
For RestClient definitions and Auth Interceptor implementation:
See [references/REFERENCE.md](references/REFERENCE.md).
## Related Topics
feature-based-clean-architecture | error-handlingTrust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | NA |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- none-observed
- Shell
- none-observed
- Dependencies
- pinned
- Secrets in source
- none-found
Findings (0)
No findings outside the package's declared scope.
Gates applied: no_behavioural_pass.
6f5be687a268full audit observations/trust-audit/skill/hoangnguyen0403__flutter-retrofit-networking.json · Report an issue / request a re-scanAudit history
Every audit this skill has had.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-14 | 6f5be687a268 | SAFE | B | 89 | first audit |
Questions
What does the Flutter Retrofit Networking skill do?
A collection of Agent Skills Standard and Best Practice for Programming Languages, Frameworks that help our AI Agent follow best practies on frameworks and programming laguages
Is Flutter Retrofit Networking safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can Flutter Retrofit Networking access on my machine?
The audit observed no filesystem, network or shell use at all in its source.
How current is this page?
The grade is for one exact copy of the source (6f5be687a268), read on 2026-10-14. The repository is watched, and a new audit runs when it changes — this is the first audit.