TestClient class final

A real ConfigDirectorClient together with the controls that decide what its in-memory server delivers.

Create one with createTestClient. Value changes reach the client the way a server update does, so watch streams, onConfigsUpdated, and reads all reflect them. Deliveries arrive asynchronously: await pumpEventQueue() in a test, or await tester.pump() in a testWidgets, before asserting.

Properties

client → ConfigDirectorClient
The SDK client under test. Pass it wherever production code accepts a ConfigDirectorClient, and dispose it as production code would.
no setter
contextUpdates → List<ConfigDirectorContext>
The context of every initialize and updateContext call, in call order. initialize without a context records an empty context. resumeNetwork is not recorded.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

completeContextUpdate() → void
Delivers the stored values to a held updateContext, which then completes with the client ready. Called while a hold is armed but no updateContext has picked it up, it disarms the hold.
completeInitialization() → void
Delivers the stored values to a held initialize, which then completes with the client ready. Called while a hold is armed but no initialize has picked it up, it disarms the hold.
failContextUpdate() → void
Fails a held updateContext the way an invalid SDK key does: it completes promptly, the client is not ready, and an error is logged. Called while no updateContext is held, it arms the next one to fail.
failInitialization() → void
Fails a held initialize the way an invalid SDK key does: it completes promptly, the client is not ready, and an error is logged. Called while no initialize is held, it arms the next one to fail.
holdContextUpdate() → void
Makes the next updateContext wait, not ready, until completeContextUpdate or failContextUpdate, or until the client's timeout elapses.
holdInitialization() → void
Makes the next initialize wait, not ready, until completeInitialization or failInitialization, or until the client's timeout elapses.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeValue(String key) → void
Removes the value under key and, once the client is connected, delivers a full update without it, so key reads as its in-code default value.
replaceValues(Map<String, Object?> values) → void
Replaces every stored value with values, disarms any armed hold or failure, and, once the client is connected, delivers a full update. Use it to reset a test client shared across tests.
setValue(String key, Object? value) → void
Stores value under key and, once the client is connected, delivers an update carrying only key. See createTestClient for the accepted values.
toString() → String
A string representation of this object.
inherited

Operators

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