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
- Host: GitHub
- URL: https://github.com/flutter-news-app-full-source-code/data-api
- Owner: flutter-news-app-full-source-code
- License: other
- Created: 2025-04-24T16:51:31.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-02-03T01:22:36.000Z (4 months ago)
- Last Synced: 2026-02-08T08:55:28.031Z (4 months ago)
- Language: Dart
- Homepage:
- Size: 3.86 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Data API
A concrete implementation of the `DataClient` abstract class for interacting with data resource endpoints via HTTP.
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.