FakeSimpleQueryPlatform class
A test-only SimpleQueryPlatform implementation with safe defaults for every method and per-method call counters.
Use as-is when a test only needs "some implementation is wired up", or subclass to override individual methods. Every fake exported from this library is intentionally simple; richer scenarios should live in each test's own fixture rather than bloating this helper.
This type is exported from simple_query_platform_interface/testing.dart.
- Inheritance
-
- Object
- PlatformInterface
- SimpleQueryPlatform
- FakeSimpleQueryPlatform
Constructors
-
FakeSimpleQueryPlatform({CapabilitySnapshot? capabilities, QueryResult? queryResult, MutationResult? mutationResult, BatchResult? batchResult, BinaryContentHandle? binaryContentHandle, Stream<
ObserveEvent> ? observeStream, Map<String, Object?> ? extensionResult})
Properties
- batchCalls ↔ int
-
getter/setter pair
-
batchRequests
→ List<
BatchRequest> -
final
-
binaryRequests
→ List<
BinaryRequest> -
final
- callExtensionCalls ↔ int
-
getter/setter pair
- closeBinaryCalls ↔ int
-
getter/setter pair
- disposeCalls ↔ int
-
getter/setter pair
- getCapabilitiesCalls ↔ int
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- mutateCalls ↔ int
-
getter/setter pair
-
mutationRequests
→ List<
MutationRequest> -
final
- observeCalls ↔ int
-
getter/setter pair
-
observeRequests
→ List<
ObserveRequest> -
final
- openBinaryCalls ↔ int
-
getter/setter pair
- queryCalls ↔ int
-
getter/setter pair
-
queryRequests
→ List<
QueryRequest> -
final
-
queryResultsByCall
↔ List<
QueryResult> ? -
When non-null, query returns the next entry per call (allowing
tests to script a multi-page response sequence). Last entry sticks.
When null, query returns the constructor's
queryResultfor every call.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
batch(
BatchRequest request) → Future< BatchResult> -
Executes a batch of mutations with
sequentialBestEffortsemantics: a failed operation records its error in its own MutationResult.metadataerrorkey and does not abort the batch.override -
callExtension(
{required String namespace, required String method, Map< String, Object?> ? args}) → Future<Map< String, Object?> ?> -
Calls a platform-specific extension method. The available
namespaces and methods are documented per platform in
docs/extensions/<platform>.md. Returnsnullwhen the extension has no structured response.override -
closeBinary(
String handleId) → Future< void> -
Releases a handle previously returned by openBinary. Safe to
call more than once.
override
-
dispose(
) → Future< void> -
Releases platform resources (observers, open binary handles, etc.).
Typically called once at app shutdown. Idempotent.
override
-
getCapabilities(
) → Future< CapabilitySnapshot> -
Reports, for every QueryDomain, which operations
(read / write / observe / stream) are usable on this device right
now. Check this before issuing any request — the unsupported
default reports everything as
false.override -
mutate(
MutationRequest request) → Future< MutationResult> -
Executes a single insert / update / delete. Throws
SimpleQueryError on failure.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
observe(
ObserveRequest request) → Stream< ObserveEvent> -
Watches ObserveRequest.domain for changes. Emits
ObserveEvents until the subscription is cancelled. Unsupported
platforms emit a single SimpleQueryError with
code: notSupported.override -
openBinary(
BinaryRequest request) → Future< BinaryContentHandle> -
Opens binary content (e.g. a photo body) and returns a handle.
Pair with closeBinary. Consumers should prefer the facade's
openBinaryContent/withBinaryContenthelpers, which wrap the raw handle with a self-closing lifecycle.override -
query(
QueryRequest request) → Future< QueryResult> -
Runs
requestagainst the platform backend. Throws SimpleQueryError on failure; thecodenames the reason (notSupported,permissionDenied,invalidQuery,unavailable,transientFailure).override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited