High-level facade that encapsulates RPC plumbing for the data service.
Goals:
- Hide RpcCallerEndpoint / RpcResponderEndpoint details from application code;
- Provide a single interface for deploying the service (server side) and calling it (client side);
- Simplify in-memory setups (tests, demos, local dev);
- Centralize advanced settings (dataTransferMode, repository, etc.) in one place.
If needed you can still use the low-level classes (DataServiceCaller / DataServiceResponder) directly — they keep working as before. Unified interface for CRUD/Query operations. Returns already “unpacked” data instead of *Response objects where it makes sense.
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
bulkDelete(
{required String collection, required List< String> ids, RpcContext? context}) → Future<int> - Bulk delete by record ids, returning the number deleted.
-
bulkUpsert(
{required Iterable< DataRecord> records, RpcContext? context}) → Future<List< DataRecord> > - Bulk upsert of a list of records.
-
bulkUpsertStream(
{required Stream< DataRecord> records, RpcContext? context}) → Future<List< DataRecord> > - Streaming variant of bulk upsert.
-
close(
) → Future< void> - Closes the client RPC connection and releases associated resources.
-
create(
{required String collection, required Map< String, dynamic> payload, String? id, RpcContext? context}) → Future<DataRecord> - Creates a record in the collection and returns the stored document with id/version set.
-
createCollectionIndex(
{required String collection, required String path, String? indexName, RpcContext? context}) → Future< CollectionIndex> - Creates an index on the specified field path.
-
delete(
{required String collection, required String id, int? expectedVersion, RpcContext? context}) → Future< bool> - Deletes a record and returns a success flag.
-
deleteCollection(
{required String collection, RpcContext? context}) → Future< bool> - Drops a collection and all its data.
-
deleteCollectionIndex(
{required String collection, required String path, String? indexName, RpcContext? context}) → Future< bool> - Deletes a defined index.
-
exportDatabase(
{RpcContext? context}) → Stream< Uint8List> - Exports the entire database as NDJSON chunks (server stream).
-
exportSnapshot(
{required String collection, RpcContext? context}) → Future< ExportSnapshotResponse> - Exports a snapshot of a collection.
-
get(
{required String collection, required String id, RpcContext? context}) → Future< DataRecord?> -
Returns a record by id or
nullwhen the record does not exist. -
getSchema(
{required String collection, RpcContext? context}) → Future< GetSchemaResponse> - Get schema for a collection.
-
importDatabase(
{required Stream< Uint8List> payload, bool replaceExisting = true, int resumeAfterChunk = -1, RpcContext? context}) → Future<ImportDatabaseResponse> - Imports the database from NDJSON chunks (client stream).
-
list(
{required String collection, RecordFilter? filter, SortOrder? sort, QueryOptions options, RpcContext? context}) → Future< ListRecordsResponse> - Returns a page of records with filtering, sorting, and pagination applied.
-
listAllRecords(
{required String collection, RecordFilter? filter, SortOrder? sort, RpcContext? context}) → Future< List< DataRecord> > -
Dumps the entire collection by iterating
listpages. -
listCollections(
{RpcContext? context}) → Future< List< String> > - Returns the list of available collections (data namespaces).
-
listSchemas(
{RpcContext? context}) → Future< ListSchemasResponse> - List active schemas.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patch(
{required String collection, required String id, required int expectedVersion, required RecordPatch patch, RpcContext? context}) → Future< DataRecord> - Applies a patch to a record, checking the expected version (optimistic locking).
-
search(
{required String collection, required String query, RecordFilter? filter, QueryOptions options, RpcContext? context}) → Future< SearchRecordsResponse> - Performs full-text/indexed search over a collection with filters and query options.
-
setSchemaPolicy(
{required String collection, required bool enabled, required bool requireValidation, RpcContext? context}) → Future< SetSchemaPolicyResponse> - Set schema policy (enable/require) for a collection.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
{required String collection, required String id, required int expectedVersion, required Map< String, dynamic> payload, RpcContext? context}) → Future<DataRecord> - Fully replaces a record, checking the expected version (optimistic locking).
-
watchChanges(
{required String collection, String? cursor, RpcContext? context}) → Stream< DataChangeEvent> - Subscribes to a change stream for the selected collection.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited