CircuitBreakerState enum

Represents the operational state of the Circuit Breaker pattern.

The circuit breaker is a resilience pattern that prevents an application from repeatedly attempting an operation that is likely to fail, such as making network requests when the internet is completely down.

Inheritance
Available extensions

Values

closed → const CircuitBreakerState

The circuit is healthy and closed.

Requests are allowed to pass through to the network. If a certain number of consecutive failures occur (defined by circuitBreakerThreshold), the circuit transitions to open.

open → const CircuitBreakerState

The circuit is broken and open.

Requests are blocked immediately without even attempting a network probe. This state persists for a cooldown period (circuitBreakerCooldownMs), after which it transitions to halfOpen.

halfOpen → const CircuitBreakerState

The circuit is in a trial state.

A single request is allowed to pass through. If it succeeds, the circuit returns to closed. If it fails, it returns to open and the cooldown period restarts.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
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

Constants

values → const List<CircuitBreakerState>
A constant List of the values in this enum, in order of their declaration.