A Simple, Robust API Service for Dart

Manage API calls with a built-in request queue, unified response handling, and a flexible singleton pattern.

Core Features

⚙️

Singleton Pattern

Ensures one and only one instance of the service, providing a single, global point of access to your API client.

🚦

Request Queuing

Automatically processes API calls sequentially, preventing race conditions and simplifying state management.

⚠️

Custom Error Handling

A flexible `ErrorHandler` callback allows you to implement app-wide error logic in one central place.

📦

Unified API Response

All calls return a consistent `ApiResponse` object, simplifying how you handle success, failure, and data.

Installation

Get started by adding the package to your `pubspec.yaml` file and running `dart pub get`.

dependencies:
  simple_api_service: ^0.0.1

Interactive Usage Demo

This interactive demo shows how to use the `ApiService`. Select a tab to see the code, then click "Run Demo" to simulate the API call and see the result in the console.

Mock Console Output

> Console ready. Click "Run Demo" to see output.

Contributing

Contributions are welcome! If you find a bug or have an idea for a new feature, please open an issue or submit a pull request on the GitHub repository.