An open API service indexing awesome lists of open source software.

https://github.com/flutter-news-app-full-source-code/data-api

A concrete implementation of the DataClient abstract class within the Flutter News App Full Source Code Toolkit
https://github.com/flutter-news-app-full-source-code/data-api

Last synced: 4 months ago
JSON representation

A concrete implementation of the DataClient abstract class within the Flutter News App Full Source Code Toolkit

Awesome Lists containing this project

README

          


Flutter News App Toolkit Logo

Data API


A concrete implementation of the `DataClient` abstract class for interacting with data resource endpoints via HTTP.



coverage
Live Docs: View
Main Project: Browse

This `data_api` package serves as a concrete implementation of the `DataClient` abstract class within the [**Flutter News App Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code). It provides a robust and generic way to interact with RESTful data resource endpoints via HTTP, leveraging the `http_client` package for underlying communication and standardized error handling. This package ensures consistent data access across the Flutter mobile app, web dashboard, and Dart Frog backend API.

## ⭐ Feature Showcase: Seamless Data Endpoint Interaction

This package offers a comprehensive set of features for interacting with API data resources.

🧱 Core Functionality

### 🚀 Generic `DataClient` Implementation
- **`DataApi` Class:** A concrete implementation of the `DataClient` abstract class, enabling type-safe interactions with various data models.
- **Unified API Endpoint Interaction:** Configurable with a `modelName` (identifying the resource in the API) and `fromJson`/`toJson` functions for seamless serialization and deserialization of specific model types `T`.

### 🌐 Comprehensive Data Operations
- **CRUD Operations:** Implements `create`, `read`, `update` methods returning `Future>`, and `delete` returning `Future`.
- **Advanced Querying:** Provides a unified `readAll` method returning `Future>>`, supporting rich, document-style filtering (`filter`), multi-field sorting (`sort`), and cursor-based pagination (`pagination`).
- **Counting and Aggregation:** Includes `count` for efficient document counting and `aggregate` for executing complex data aggregation pipelines directly on the data source.

### 🛡️ Integrated Error Handling
- **`HttpException` Propagation:** Propagates standardized `HttpException` errors (e.g., `NetworkException`, `BadRequestException`, `NotFoundException`) from the underlying `http_client` package, ensuring consistent and predictable error management.

### 💉 Dependency Injection Ready
- **`HttpClient` Dependency:** Requires an instance of `HttpClient` (from the `http_client` package) via its constructor, promoting loose coupling and testability.

> **💡 Your Advantage:** You get a meticulously designed, production-quality data API client that simplifies interactions with your backend, ensures type safety, provides robust error handling, and supports advanced querying capabilities. This package accelerates development by providing a solid foundation for data access.

## 🔑 Licensing

This source code is licensed for commercial use and is provided for local evaluation. A **Lifetime Commercial License** is required for any production or public-facing application.

Please visit the main [Flutter News App Full Source Code Toolkit](https://github.com/flutter-news-app-full-source-code) organization page to review the full license terms and to purchase.