SmartApiResponse<T> class

The typed result handed back from every SmartApiClient call.

Check success first; when it's true, data is populated (typed as T if you passed a fromJson converter). When it's false, use message for a user-facing error and statusCode/raw for debugging.

Constructors

SmartApiResponse({required bool success, String message = "", int? statusCode, T? data, dynamic raw})
Creates a response directly. You'll normally receive one from SmartApiClient.instance.get/post/put/delete rather than constructing it yourself.
const

Properties

data → T?
The typed payload, converted with fromJson if one was supplied. Null when success is false or the backend returned no data.
final
hashCode → int
The hash code for this object.
no setterinherited
message → String
A human-readable message — populated on failure, and on success only if your backend includes one.
final
raw → dynamic
The raw, un-typed response body, useful for debugging or for reading fields your fromJson converter doesn't cover.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
statusCode → int?
The HTTP status code of the response, when available.
final
success → bool
Whether the call succeeded, per SmartApiEnvelope.success (or your custom responseParser).
final

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