InMemoryRepositoryAdapter class

A web-safe, in-memory RepositoryAdapter backing tests and browser demos.

Files live in a path -> content map (POSIX-relative paths). It supports the full filesystem + search surface; git is not supported (its methods throw a RepoException), matching a workspace with no VCS.

Implemented types

Constructors

InMemoryRepositoryAdapter([Map<String, String>? files])

Properties

capabilities RepoCapabilities
What this adapter can/‌may do, so tools can report unsupported operations cleanly.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(String path) Future<void>
Deletes the file or directory path.
override
edit(String path, String oldString, String newString, {bool replaceAll = false, int? atLine}) Future<RepoEdit>
Replaces oldString with newString in path. When replaceAll is false exactly one occurrence must match. When atLine is given, the match must occur on that 1-based line or the edit is rejected.
override
find({String? glob, int? limit}) Future<List<String>>
Finds files whose workspace-relative path matches glob (returns up to limit paths).
override
gitAdd(List<String> paths) Future<GitResult>
override
gitBlame(String path) Future<List<GitBlameLine>>
override
gitCheckout(String rev) Future<GitResult>
override
gitCommit(String message, {List<String>? paths}) Future<GitResult>
override
gitDiff({String? rev, bool staged = false, String? path}) Future<String>
override
gitLog({int? limit, String? path}) Future<List<GitCommit>>
override
gitRestore(List<String> paths, {bool staged = false}) Future<GitResult>
override
gitShow({required String rev, String? path}) Future<String>
override
gitStatus() Future<List<GitStatusEntry>>
override
list(String path, {bool recursive = false, int? maxDepth, String? glob}) Future<List<RepoEntry>>
Lists the directory at path. When recursive, descends up to maxDepth levels; glob filters entries by name/path pattern.
override
mkdir(String path) Future<void>
Creates the directory path (and any missing parents).
override
move(String from, String to) Future<void>
Moves/renames from to to.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String path, {LineRange? range}) Future<RepoFile>
Reads path, optionally only the lines in range.
override
searchText(String pattern, {String? glob, bool ignoreCase = false, int context = 0, int? limit}) Future<List<TextMatch>>
Searches file contents for pattern (a regular expression). glob limits which files are searched; context lines of surrounding text are attached.
override
stat(String path) Future<RepoStat>
Metadata for path (never throws for a missing path — returns exists: false).
override
toString() String
A string representation of this object.
inherited
write(String path, String content) Future<RepoEdit>
Creates or overwrites path with content.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited