flutter-dio
Use when configuring HTTP network clients with Dio, adding auth token interceptors, handling retry logic, or caching API responses.
Skill by dhruvanbhalara
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/dhruvanbhalara-flutter-dio
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, security
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/flutter-dio
What's inside
- Skill name
flutter-dio- Description
- Use when configuring HTTP network clients with Dio, adding auth token interceptors, handling retry logic, or caching API responses.
- License
- MIT
- Metadata
- category: networking · languages: dart · platforms: flutter
- Instructions
- 91 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Networking with Dio
- Use **Dio** as the primary HTTP client package.
- Use type-safe model classes with `fromJson` / `toJson` factories for all request/response bodies.
- Handle all HTTP status codes appropriately with typed exceptions (e.g., `ServerException`, `NetworkException`, `UnauthorizedException`).
- Use proper request timeouts (`connectTimeout`, `receiveTimeout`, `sendTimeout`).
# Dio Interceptors
- Use interceptors for cross-cutting concerns:
- **Auth Interceptor**: Attach access tokens to headers, handle token refresh on 401.
- **Logging Interceptor**: Log requests/responses in debug mode via `AppLogger`.
- **Error Interceptor**: Transform `DioException` into domain-specific `Failure` types.
- Register interceptors centrally via `injectable` for consistent behavior across all API calls.
# Repository Pattern
- DataSources contain only raw Dio API calls: no business logic or mapping
- Repositories orchestrate between remote DataSources and local cache for network data
# Retry & Resilience
- Implement retry logic with exponential backoff for transient failures (e.g., 500, timeout).
- Set a maximum retry count (default: 3 retries).
- Cache responses when appropriate to reduce network calls and improve offline UX.
# Performance
- Parse JSON in background isolates for large responses (> 1MB) using `compute()`
- Do NOT block the UI thread with synchronous network operations
# Security
- Store tokens via `flutter_secure_storage`: never in source code or `SharedPreferences`
- All API communication MUST use HTTPS
# Alternative: http Package
For simple REST calls that don't need interceptors, caching, or retry logic, use `http` instead of Dio.
## Dio vs http
| Criteria | `http` | `Dio` |
|---|---|---|
| **Interceptors** | No | Yes, full chain |
| **Retry logic** | Manual | Built-in with backoff |
| **Response caching** | Manual | Plugin available |
| **FormData / Multipart** | Manual | Built-in |
| **Cancel requests** | No | Yes, `CancelToken` |
| **Dependencies** | Minimal (1 package) | Heavier |
| **Use case** | Simple CRUD APIs | Production API clients |
Use `http` for prototypes and simple fetch-and-display. Use `Dio` for production API clients that need auth, retry, and caching.
## Basic http Patterns
```dart
import 'dart:convert';
import 'package:http/http.dart' as http;
// GET request
Future<Map<String, dynamic>> fetchData(http.Client client) async {
final response = await client.get(
Uri.parse('https://api.example.com/data'),
headers: {'Accept': 'application/json'},
);
if (response.statusCode == 200) {
return jsonDecode(response.body) as Map<String, dynamic>;
} else {
throw Exception('Failed to fetch: ${response.statusCode}');
}
}
// POST request
Future<void> createItem(http.Client client, Map<String, dynamic> body) async {
final response = await client.post(
Uri.parse('https://api.example.com/items'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode(body),
);
if (response.statusCode != 201) {
throw Exception('Failed to create: ${response.statusCode}');
}
}
```
**Testing**: Always accept `http.Client` as a parameter (not `http.get()` directly) to enable mock injection in tests.From dhruvanbhalara/skills, MIT.
More from dhruvanbhalara/skills
- 0.611score
dart-fix-runtime-errors
dhruvanbhalara
Use when diagnosing runtime failures, type cast errors, null check violations, or unhandled asynchronous exceptions in Dart.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
dart-build-cli-app
dhruvanbhalara
Use when creating Dart command-line tools, parsing CLI arguments with args, handling exit codes, or managing child processes.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
dart-logic-patterns
dhruvanbhalara
Use when organizing business logic, implementing algorithmic workflows, or applying Dart data structures and pattern matching.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
dart-memory
dhruvanbhalara
Use when troubleshooting memory leaks, optimizing garbage collection overhead, or disposing streams and listeners in Dart.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-add-widget-preview
dhruvanbhalara
Use when configuring widget previews in Flutter development, testing visual component variations, or isolating widget UI states.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-apply-architecture-best-practices
dhruvanbhalara
Use when structuring Flutter application layers across data, domain, and presentation using Clean Architecture and BLoC.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-bloc
dhruvanbhalara
Use when implementing state management with sealed BLoC classes, registering dependency injection with injectable, or setting up GoRouter listeners.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-bloc-forms
dhruvanbhalara
Use when managing complex form state, synchronous and asynchronous input validation, or form submission transitions in BLoC.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-config
dhruvanbhalara
Use when configuring build flavors, passing environment variables via dart-define-from-file, or setting up stage-specific credentials.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-debugging
dhruvanbhalara
Use when diagnosing Flutter layout issues, inspecting widget rebuilds, setting breakpoints, or tracking down UI rendering anomalies.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-devtools
dhruvanbhalara
Use when profiling CPU performance, tracking memory leaks, inspecting widget trees, or viewing network traffic in Flutter DevTools.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-firebase
dhruvanbhalara
Use when integrating Firebase Authentication, Cloud Firestore, Cloud Messaging, Crashlytics, or Firebase Analytics in Flutter.
SkillBFreshness: B★ 30Claude Code +9
Signals
- Stars
- 30
- Forks
- 4
- Open issues
- 0
- Last commit (this folder)
- Aug 29, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/dhruvanbhalara/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from dhruvanbhalara
- 0.611score
dart-fix-runtime-errors
dhruvanbhalara
Use when diagnosing runtime failures, type cast errors, null check violations, or unhandled asynchronous exceptions in Dart.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
dart-build-cli-app
dhruvanbhalara
Use when creating Dart command-line tools, parsing CLI arguments with args, handling exit codes, or managing child processes.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
dart-logic-patterns
dhruvanbhalara
Use when organizing business logic, implementing algorithmic workflows, or applying Dart data structures and pattern matching.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
dart-memory
dhruvanbhalara
Use when troubleshooting memory leaks, optimizing garbage collection overhead, or disposing streams and listeners in Dart.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-add-widget-preview
dhruvanbhalara
Use when configuring widget previews in Flutter development, testing visual component variations, or isolating widget UI states.
SkillBFreshness: B★ 30Claude Code +9 - 0.611score
flutter-apply-architecture-best-practices
dhruvanbhalara
Use when structuring Flutter application layers across data, domain, and presentation using Clean Architecture and BLoC.
SkillBFreshness: B★ 30Claude Code +9
Cite this page
flutter-dio skill. Agent Mart. https://agentmart.dev/skills/dhruvanbhalara-flutter-dio (last updated 2026-10-24)