Skip to content

flutter-news-app-full-source-code/data-inmemory

Repository files navigation

Flutter News App Toolkit Logo

Data In-Memory

An in-memory implementation of the `DataClient` interface for the Flutter News App Toolkit.

coverage Live Docs: View Main Project: Browse

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. 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<T> Class: A concrete in-memory implementation of the DataClient<T> 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 data_inmemory package is an integral part of the Flutter News App Full Source Code Toolkit. For comprehensive details regarding licensing, including trial and commercial options for the entire toolkit, please refer to the main toolkit organization page.

About

An in-memory implementation of the `DataClient` interface for the Flutter News App Toolkit.

Resources

License

Stars

Watchers

Forks

Languages