HealthResponse class

Aggregated response from multiple health indicators.

Follows the draft RFC for Health Check Response Format: https://datatracker.ietf.org/doc/html/draft-inadarei-api-health-check-06

Constructors

HealthResponse({required HealthStatus status, required Map<String, List<HealthCheckResult>> checks, String? notes, String? output, required DateTime time})
Creates a health response.
const
HealthResponse.alive()
Creates a minimal passing response (for /livez).
factory
HealthResponse.fromResults(List<HealthCheckResult> results)
Creates a health response from a list of check results.
factory

Properties

checks → Map<String, List<HealthCheckResult>>
Individual check results grouped by indicator name.
final
hashCode → int
The hash code for this object.
no setterinherited
httpStatusCode → int
HTTP status code for this response (200 for pass, 503 for fail).
no setter
isHealthy → bool
Whether the overall status is healthy.
no setter
notes → String?
Human-readable notes about the overall health status.
final
output → String?
Detailed output message, especially useful for failures.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status → HealthStatus
Overall status of the health check.
final
time → DateTime
Timestamp when this response was generated.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Converts this response to a JSON map following the RFC format.
toString() → String
A string representation of this object.
inherited

Operators

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