You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(ht_data_inmemory_client): add initialData constructor parameter for preloading data
- Implement optional initial data population through the 'initialData' parameter
- Add error handling for duplicate IDs in initial data
- Update README.md to reflect new feature
- Provide code example for using initialData in main function
Copy file name to clipboardExpand all lines: README.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ Key characteristics:
14
14
-**In-Memory Storage:** Data is stored locally in Dart `Map` objects. Data is lost when the client instance is destroyed.
15
15
-**Dependency on `ht_data_client`:** Implements the standard data client interface.
16
16
-**Requires ID and JSON Logic:** You must provide functions to extract a unique ID (`getId`) and serialize items to JSON (`toJson`) during instantiation. The client does *not* generate IDs itself.
17
+
-**Optional Initial Data:** You can optionally provide a `List<T>` via the `initialData` constructor parameter to pre-populate the client. Throws `ArgumentError` if duplicate IDs are found in the initial data.
17
18
-**Simple Querying:** The `readAllByQuery` method performs basic key-value matching on the JSON representation of items. It does not support complex queries (ranges, advanced sorting, etc.).
18
19
-**Error Simulation:** Throws exceptions like `NotFoundException` and `BadRequestException` (from `package:ht_http_client`) to simulate common API errors.
19
20
-**Pagination:** Supports basic pagination via `startAfterId` and `limit` parameters on `readAll` and `readAllByQuery`.
0 commit comments