FakeAutoCapture class final

An SmsAutoCapture a test drives by hand, and can assert against.

The seam is harder to fake than it looks: messages has to hand back the same stream on every call and tolerate a fresh listen before the previous cancel has settled, which is what a session does when a verification is restarted. A plain broadcast controller fails the second requirement.

Implemented types

Constructors

FakeAutoCapture({String? hash = 'A1b2C3d4E5f', Object? failsWith})
Reports hash, and delivers whatever is pushed to deliver.

Properties

cancels int
How many times a session has cancelled.
getter/setter pair
failsWith Object?
Thrown by appHash instead of returning, when set.
final
hash String?
The value appHash resolves to. Null stands for a platform with none.
final
hashCalls int
How many times a session has asked for the hash.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
listens int
How many times a session has subscribed.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

appHash() Future<String?>
The 11-character app hash for this build, or null when it cannot be computed or the platform has no automatic capture.
override
close() Future<void>
Releases the underlying controller.
deliver(String body) → void
Pushes a message body to whatever is listening.
messages() Stream<String>
Raw message bodies the platform hands over.
override
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