UnauthorizedResponse class

A model representing an unauthorized error response (HTTP 401).

This typically occurs when authentication credentials are missing or invalid.

Constructors

UnauthorizedResponse({required int timestamp, required int statusCode, required String error, required String message})
Constructs an UnauthorizedResponse instance with all required fields.

Properties

error → String
A short string describing the error (e.g., "Unauthorized").
final
hashCode → int
The hash code for this object.
no setterinherited
message → String
A human-readable message providing more detail about the error.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
statusCode → int
The HTTP status code returned by the server (should be 401 for unauthorized access).
final
timestamp → int
The timestamp when the error occurred, represented as a Unix epoch (milliseconds).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Converts this instance into a JSON-compatible map.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

fromJson(Map<String, dynamic> json, int statusCode) → UnauthorizedResponse?
Factory method to parse a JSON map and statusCode into an UnauthorizedResponse object.