Skip to content
Development
Skill

/flutter-retrofit-networking

Build type-safe HTTP networking with Dio and Retrofit including auth interceptors in Flutter. Use when integrating REST APIs with Dio or Retrofit.

From plugin
agent-skills-standard
583200 skills21 agents33 commands1 MCP

Claude Code

$ npx -y skills add hoangnguyen0403/agent-skills-standard --skill flutter-retrofit-networking --agent claude-code

SKILL.md

flutter-retrofit-networking.SKILL.md
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

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-handling

Read more
@hoangnguyen0403
Ships withagent-skills-standard

The portable standards layer for AI coding agents. Sync once, then work in your own runtime.

583200 skills21 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
583
Star history of hoangnguyen0403/agent-skills-standard on GitHub, a chart by star-history.com

Other skills on agent-skills-standard.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about flutter-retrofit-networking.

Which coding agents can use flutter-retrofit-networking?
flutter-retrofit-networking installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.