Failure class sealed

Anything that can go wrong on the way to a value.

Operations return Result<T> carrying a Failure on the error path, so callers never have to catch raw exceptions or guess at an error's shape.

The hierarchy is sealed: a switch over a Failure is exhaustive, and adding a case here is a breaking change that the compiler will point at every call site for you.

Implementers

Properties

cause → Object?
The original error this failure was mapped from, when one is known.
final
code → int?
HTTP status or application error code, when one was supplied.
final
hashCode → int
The hash code for this object.
no setterinherited
message → String
User-facing message describing what went wrong.
final
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
referenceId → String?
Server-side correlation id, when one was supplied.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stackTrace → StackTrace?
Where cause was thrown, when it was captured.
final
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
title → String
Where the failure was produced.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
Alias for toMap, for callers that pass this straight to jsonEncode.
toMap() → Map<String, Object?>
A JSON-safe map of this failure's displayable fields, for logging or an error response.
toString() → String
A string representation of this object.

Operators

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