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 Properties

length int
Returns the number of recorded entries.
no setter

Static Methods

clear() → void
Removes all recorded entries from storage.
containsKey(String key) bool
Returns true if a recorded entry exists for the given key.
get(String key) → MockEntry?
Retrieves the MockEntry for the given key, or null if not found.
set(String key, MockEntry entry) → void
Stores a MockEntry under the given key.