ApiFailure class final

The server was reached and answered, but reported the operation failed.

message, code and referenceId come from the server's own response, which makes this the one variant whose message is generally fit to show to a user as-is.

Inheritance

Constructors

ApiFailure({required String title, required String message, int? code, String? referenceId, Object? cause, StackTrace? stackTrace})
Creates a failure describing a server-reported error.
const

Properties

cause Object?
The original error this failure was mapped from, when one is known.
finalinherited
code int?
HTTP status or application error code, when one was supplied.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
message String
User-facing message describing what went wrong.
finalinherited
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setterinherited
referenceId String?
Server-side correlation id, when one was supplied.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTrace StackTrace?
Where cause was thrown, when it was captured.
finalinherited
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.
finalinherited

Methods

copyWith({String? title, String? message, int? code, String? referenceId, Object? cause, StackTrace? stackTrace}) ApiFailure
A copy of this failure with the given fields replaced.
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