https://github.com/flutter-news-app-full-source-code/data-inmemory
An in-memory implementation of the `DataClient` interface for the Flutter News App Toolkit.
https://github.com/flutter-news-app-full-source-code/data-inmemory
Last synced: 4 months ago
JSON representation
An in-memory implementation of the `DataClient` interface for the Flutter News App Toolkit.
- Host: GitHub
- URL: https://github.com/flutter-news-app-full-source-code/data-inmemory
- Owner: flutter-news-app-full-source-code
- License: other
- Created: 2025-04-26T06:31:58.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-02-03T04:31:16.000Z (4 months ago)
- Last Synced: 2026-02-08T08:55:28.493Z (4 months ago)
- Language: Dart
- Homepage:
- Size: 158 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Data In-Memory
An in-memory implementation of the `DataClient` interface for the Flutter News App Toolkit.
This `data_inmemory` package provides a lightweight, non-persistent in-memory implementation of the `DataClient` interface within the [**Flutter News App Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code). It is designed primarily for testing, local development, or scenarios where a temporary data store is sufficient. This package allows for simulating a backend data source entirely in memory, supporting standard CRUD operations, advanced querying, and aggregation capabilities without requiring a live database connection.
## ⭐ Feature Showcase: Flexible In-Memory Data Management
This package offers a comprehensive set of features for managing data entities in memory.
🧱 Core Functionality
### 🚀 `DataClient` Implementation
- **`DataInMemoryClient` Class:** A concrete in-memory implementation of the `DataClient` interface, enabling type-safe interactions with various data models.
- **Flexible Initialization:** Supports `initialData` to pre-populate the client with existing data, accelerating setup for testing and development.
### 🌐 Comprehensive Data Operations
- **CRUD Operations:** Implements `create`, `read`, `update`, and `delete` methods for standard data manipulation.
- **User-Scoped & Global Data:** Supports operations tied to a specific `userId` for user-scoped data, as well as operations targeting global data not associated with any user.
- **Rich Document-Style Querying:** The `readAll` method supports advanced filtering with operators like `$in`, `$nin`, `$ne`, `$gte` on any field (including nested ones), multi-field sorting via `SortOption` objects, and cursor-based pagination via `PaginationOptions`.
- **Generic Text Search:** Supports the `$regex` operator for powerful, case-insensitive text searches on any string field (e.g., `{'name': {'$regex': 'term', '$options': 'i'}}`).
- **Efficient Counting & Aggregation:** Includes a `count` method for efficient document counting and an `aggregate` method to simulate basic MongoDB aggregation pipelines (supporting `$match`, `$group`, `$sort`, `$limit`), enabling testing of analytics-style queries.
### 🛡️ Standardized Error Handling
- **`HttpException` Propagation:** Throws standard exceptions from `package:core` (e.g., `NotFoundException`, `BadRequestException`) for consistent error handling, ensuring predictable error management across the application layers.
> **💡 Your Advantage:** You get a meticulously designed, production-quality in-memory data client that simplifies testing, accelerates local development, and provides robust data management capabilities without the overhead of a persistent backend. This package is ideal for rapid prototyping and reliable unit/integration testing.
## 🔑 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.