π zeba_academy_api_client
Enterpriseβgrade REST and GraphQL API client for Flutter and Dart applications.
zeba_academy_api_client provides a powerful networking layer with interceptors, retry logic, caching, offline support, logging, file upload/download, and pagination helpers.
Designed for production apps, EdTech platforms, SaaS apps, and large Flutter projects.
β¨ Features
β REST API wrapper
β GraphQL support
β Interceptor system (similar to Dio)
β Automatic retry logic
β Token refresh handling
β Centralized error handling
β Request / response logging
β Timeout configuration
β Inβmemory request caching
β Offlineβready architecture
β File upload
β File download
β API mocking for testing
β Pagination helpers
π¦ Installation
Add the dependency in your pubspec.yaml:
dependencies:
zeba_academy_api_client: ^1.0.0
Then run:
flutter pub get
π Basic Usage
import 'package:zeba_academy_api_client/zeba_academy_api_client.dart';
final client = ApiClient(
config: ApiConfig(
baseUrl: "https://jsonplaceholder.typicode.com",
),
);
final response = await client.get("/users");
print(response.data);
βοΈ Configuration
You can configure timeout, retries, headers and more.
final client = ApiClient(
config: ApiConfig(
baseUrl: "https://api.example.com",
timeout: Duration(seconds: 15),
maxRetries: 3,
),
);
π Authentication Interceptor
Interceptors allow modifying requests globally.
class AuthInterceptor extends ApiInterceptor {
final String token;
AuthInterceptor(this.token);
@override
Future<void> onRequest(RequestContext ctx) async {
ctx.headers['Authorization'] = 'Bearer $token';
}
}
Usage:
final client = ApiClient(
config: ApiConfig(baseUrl: "https://api.example.com"),
interceptors: [
AuthInterceptor("your_token"),
],
);
π Logging Interceptor
Logs all requests and responses.
final client = ApiClient(
config: ApiConfig(baseUrl: "https://api.example.com"),
interceptors: [
LoggingInterceptor(),
],
);
π Retry Logic
Automatic retries for failed network calls.
final client = ApiClient(
config: ApiConfig(
baseUrl: "https://api.example.com",
maxRetries: 3,
),
);
π§ Request Caching
Enable inβmemory caching.
final client = ApiClient(
config: ApiConfig(baseUrl: "https://api.example.com"),
cache: MemoryCache(),
);
π‘ GraphQL Support
Execute GraphQL queries easily.
final response = await client.graphql(
query: """
query GetUsers {
users {
id
name
}
}
""",
);
π€ File Upload
await client.uploadFile(
endpoint: "/upload",
filePath: "path/to/file.png",
);
π₯ File Download
await client.downloadFile(
url: "/files/report.pdf",
savePath: "downloads/report.pdf",
);
π Pagination Helper
Simplifies paginated APIs.
final page = await client.getPage(
endpoint: "/users",
page: 1,
limit: 10,
);
π§ͺ API Mocking
Useful for development and testing.
final client = ApiClient(
config: ApiConfig(baseUrl: "https://api.example.com"),
mockResponses: {
"/users": [
{"id": 1, "name": "Test User"}
]
},
);
π± Example UI
This package includes an example Flutter app demonstrating:
β’ API calls β’ Loading state β’ Error handling β’ Response rendering
πΈ Screenshots
Example Flutter UI demonstrating API request, response rendering, and error handling using zeba_academy_api_client.

Then reference the screenshot in pubspec.yaml.
screenshots:
- description: API client demo
path: screenshots/api_client_demo.png
π§© Architecture
The package is structured using modular networking layers:
lib/
βββ src/
β βββ api_client.dart
β βββ api_config.dart
β βββ api_response.dart
β βββ api_exception.dart
β βββ interceptors/
β βββ cache/
β βββ graphql/
β βββ pagination/
β βββ retry/
This architecture ensures the client is scalable, maintainable, and production ready.
π§ͺ Testing
Run tests using:
flutter test
π License
This project is licensed under the GPLβ3.0 License.
π« Zeba Academy
Built with β€οΈ for modern Flutter development and EdTech platforms.