MockStorage class
Global in-memory storage for recorded API responses.
Maps cache keys (generated from request method and path) to their corresponding response data. This is the single source of truth for all recorded mock data.
Example
A typical entry looks like:
{
'GET_/user': {
'data': {'name': 'John'},
'statusCode': 200,
'headers': { ... },
},
}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
Static Methods
-
clear(
) → void - Removes all recorded entries from storage.
-
containsKey(
String key) → bool -
Returns
trueif a recorded entry exists for the givenkey. -
get(
String key) → MockEntry? -
Retrieves the
MockEntryfor the givenkey, ornullif not found. -
set(
String key, MockEntry entry) → void -
Stores a
MockEntryunder the givenkey.