ServerHealthConfig class

Configuration for checking a single server/API's health.

Internet reachability and server reachability are deliberately separate checks — the rest of the Internet being fine does not mean your API is up, and vice versa is never assumed either.

Constructors

ServerHealthConfig({required String id, required String url, String method = 'GET', Map<String, String>? headers, Duration timeout = const Duration(seconds: 5), Set<int> expectedStatusCodes = const {200, 204}})
Creates a ServerHealthConfig.
const

Properties

expectedStatusCodes Set<int>
Status codes that count as "healthy". Anything else — including a successful connection with an unexpected code — counts as unreachable.
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
Optional headers (e.g. an API key) to send with the check.
final
id String
A short identifier for this server, used to distinguish results when monitoring multiple servers (e.g. 'auth', 'payments').
final
method String
HTTP method to use. 'GET' or 'HEAD' are typical.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeout Duration
Timeout for the health-check request.
final
url String
The health-check endpoint to call.
final

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