Joker class

Available extensions

Constructors

Joker()

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

isActive bool
Returns true if Joker is currently active and intercepting requests
no setter
stubs List<JokerStub>
Returns a list of all currently registered stubs
no setter

Static Methods

clearStubs() → void
Removes all registered stubs
createHttpClient() → dynamic
Creates an HTTP client that works with Joker stubs.
findStubForRequest({required String method, required Uri uri}) JokerStub?
Finds a stub that matches the given request parameters
getResponseForStub(JokerStub stub, {required String method, required Uri uri}) JokerResponse?
Gets the response for a matched stub
removeStub(JokerStub stub) bool
Removes a specific stub from the registered list
removeStubsByName(String name) int
Removes all stubs with the given name
start() → void
Starts intercepting HTTP requests
stop() → void
Stops intercepting HTTP requests and clears all stubs
stubJson({String? host, String? path, String? method, required Map<String, dynamic> data, int statusCode = 200, Map<String, String> headers = const {}, Duration? delay, String? name, bool removeAfterUse = false}) JokerStub
Convenience method for stubbing JSON responses
stubJsonArray({String? host, String? path, String? method, required List<Map<String, dynamic>> data, int statusCode = 200, Map<String, String> headers = const {}, Duration? delay, String? name, bool removeAfterUse = false}) JokerStub
Convenience method for stubbing JSON array responses
stubJsonFile({String? host, String? path, String? method, required String filePath, int statusCode = 200, Map<String, String> headers = const {}, Duration? delay, String? name, bool removeAfterUse = false}) Future<JokerStub>
Creates a stub for JSON response loaded from a file (asynchronous)
stubText({String? host, String? path, String? method, required String text, int statusCode = 200, Map<String, String> headers = const {}, Duration? delay, String? name, bool removeAfterUse = false}) JokerStub
Convenience method for stubbing text responses
stubUrl({String? host, String? path, String? method, required JokerResponse response, String? name, bool removeAfterUse = false}) JokerStub
Internal helper method to create and register URL-based stubs