EnsendResponse<T> class
The result envelope returned by every Ensend API call.
Either data or error will be non-null, never both.
final result = await client.send.sendMail(request);
if (result.isSuccess) {
print(result.data);
} else {
print(result.error!.message);
}
- Annotations
-
- @immutable
Constructors
- EnsendResponse({T? data, EnsendError? error})
-
const
- EnsendResponse.failure(EnsendError error)
-
const
- EnsendResponse.success(T data)
-
const
Properties
- data → T?
-
The parsed response body on success.
final
- error → EnsendError?
-
The API error on failure.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isError → bool
-
no setter
- isSuccess → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
when<
R> ({required R onSuccess(T data), required R onError(EnsendError error)}) → R -
Runs
onSuccessif successful,onErroron failure.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited