MockWebServer class

Constructors

MockWebServer.setup(List<RequestHandler> handlers)
Factory function to setup a mock server, similar to mswjs's setupServer.
factory

Properties

activeHandlers List<RequestHandler>
Get a readonly list of currently active handlers.
no setter
hashCode int
The hash code for this object.
no setterinherited
port int?
Get the port the server is listening on. Returns null if the server is not listening.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url String?
Get the URL the server is listening on. Returns null if the server is not listening.
no setter

Methods

close() Future<void>
Stop the server.
listen({int port = 0}) Future<void>
Start the server.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetHandlers([List<RequestHandler>? nextHandlers]) → void
Reset all handlers to initial state or to the provided handlers
toString() String
A string representation of this object.
inherited
use(List<RequestHandler> handlers) → void
Add route handlers.

Operators

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