MockAction class

MockAction (flattened union; type is respond, delay or fail).

Constructors

MockAction({required String type, int status = 200, List<List<String>> headers = const <List<String>>[], String? body, String bodyEncoding = 'utf8', int delayMs = 0, String error = 'connection', String? message})
An action of type; the other fields apply as their docs say.
const

Properties

body → String?
respond: body text (or base64 when bodyEncoding is base64).
final
bodyEncoding → String
respond: utf8 | base64.
final
delayMs → int
respond/fail: optional delay; delay: required delay.
final
error → String
fail: timeout | connection | dns | tls | custom.
final
hashCode → int
The hash code for this object.
no setterinherited
headers → List<List<String>>
respond: [name, value] pairs.
final
isDelay → bool
Waits delayMs, then makes the real request.
no setter
isFail → bool
Fails the request with the platform's natural error.
no setter
isRespond → bool
Answers with status, headers and body without touching the network.
no setter
message → String?
fail: optional message (used by custom).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status → int
respond: HTTP status.
final
type → String
respond | delay | fail.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
The action as wire JSON (the desktop's MockAction).
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

fromJson(Object? json) → MockAction?
Returns null for unknown/invalid actions (such rules never match).