MockRule class

MockRule.

Constructors

MockRule({required String id, required bool enabled, required String method, required String url, required String match, required MockAction action, String? name, List<String>? apps, num createdAt = 0, Object? when})
A rule as the desktop sends it; see MockRule.fromJson.
const

Properties

action → MockAction
What happens to a matching request.
final
apps → List<String>?
Bundle ids / package names; null or empty = every app.
final
conditions → MockConditions
when as the matcher reads it.
no setter
createdAt → num
Epoch milliseconds when the rule was made on the desktop.
final
enabled → bool
Disabled rules never match.
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
The desktop's id of the rule (reported back as mockRuleId).
final
label → String
Display label used in diagnostics headers.
no setter
match → String
contains | exact | glob | regex.
final
method → String
* or an HTTP method.
final
name → String?
Optional name given on the desktop.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
url → String
The URL pattern, read as match says.
final
when → Object?
when: conditions besides method / URL / apps as received (mock matching v2, e.g. {graphql: {operationName: 'GetUser'}}); null = none.
final

Methods

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

Operators

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

Static Methods

fromJson(Object? json) → MockRule?
Returns null when the JSON is not a usable rule.
listFromJson(Object? json) → List<MockRule>
The usable rules of a JSON list, in order; anything else gives an empty list.