RepositoryRpc class
A tiny, transport-agnostic JSON layer over a RepositoryService.
It maps a plain {'op': <name>, ...args} request map to the matching
RepositoryService method and serializes the result with the value types'
existing toJson(). It is web-safe (no dart:io): a server (see
tool/repository_server.dart) only has to move JSON maps in and out over
HTTP, and a RemoteRepositoryAdapter on the other side speaks the exact same
ops via the Op constants below — so the wire contract lives in one place.
Every call returns a normalized envelope:
- success →
{'ok': true, 'result': <object>} - a reported failure (RepoException) →
{'ok': false, 'error': {'type', 'message'}}, withtype=RepoPermissionExceptionorRepoException.
Result shapes (keyed so the client deserializes unambiguously):
- scalar value types (
read/stat/write/edit/capabilities/git mutations) → the value'stoJson()map directly. list/gitStatus→{'entries': [...]};find→{'paths': [...]};searchText→{'matches': [...]};gitLog→{'commits': [...]};gitBlame→{'lines': [...]};gitDiff/gitShow→{'text': ...}; void ops (mkdir/move/delete) →{}.
Constructors
- RepositoryRpc(RepositoryService service)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- service → RepositoryService
-
final
Methods
-
handle(
Map< String, Object?> request) → Future<Map< String, Object?> > -
Handles a single decoded request map and returns the response envelope.
Never throws for a RepoException; unexpected errors surface as a generic
RepoException-typed error so a server can always reply with valid JSON. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited