SonicResponse<T> class

Annotations
  • @immutable

Properties

data → T?
final
extra → Map<String, dynamic>?
final
hasError → bool
Specifies if the response contains an error.
no setter
hashCode → int
The hash code for this object.
no setteroverride
headers → Map<String, List<String>>?
final
isSuccess → bool
Specifies if the request is a success.
no setter
message → String?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sonicError → SonicError?
final
statusCode → int
final

Methods

nextCursor(Sonic sonic, {required String cursorPath, String param = 'cursor', HttpMethod method = HttpMethod.get}) → SonicRequestBuilder<T>?
Cursor helpers for common JSON body styles. Provide the cursor path (e.g., 'meta.nextCursor') and the query param name (e.g., 'cursor').
nextPage(Sonic sonic, {HttpMethod method = HttpMethod.get}) → SonicRequestBuilder<T>?
Build a new request builder for the next page using Link headers (if any). Requires providing a Sonic instance to construct the builder.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on<Y>(Y onData(T? data), Y onError(SonicError? error)) → Y
An easier syntax than writting if conditions to return instances based on response.
prevCursor(Sonic sonic, {required String cursorPath, String param = 'cursor', HttpMethod method = HttpMethod.get}) → SonicRequestBuilder<T>?
prevPage(Sonic sonic, {HttpMethod method = HttpMethod.get}) → SonicRequestBuilder<T>?
Build a new request builder for the previous page using Link headers.
to<Y>(Y callback(SonicResponse<T> data)) → Y
Transforms this instance of SonicResponse to Y type with callback
toPaged({required T itemDecoder(dynamic json), String? itemsPath, String? nextCursorPath, String? prevCursorPath, String cursorParam = 'cursor'}) → Paged<T>
Build a Paged
toString() → String
A string representation of this object.
inherited

Operators

operator ==(covariant SonicResponse<T> other) → bool
The equality operator.
override