ApiCall class final

API call action with optional success/failure branches.

Success callbacks receive an ApiResponse placeholder so later actions can refer to ActionOutput(...) instead of guessing output variable names.

Example:

ApiCall(
  createTask,
  params: {'title': State('title')},
  outputAs: 'createdTask',
  onSuccess: (_) => [
    Snackbar('Task created'),
  ],
)
Inheritance
Implemented types
Annotations
  • @immutable

Constructors

ApiCall(Endpoint endpoint, {Map<String, Object?>? params, ApiSuccessBuilder? onSuccess, List<DslAction>? onFailure, String? outputAs})

Properties

endpoint Endpoint
final
hashCode int
The hash code for this object.
no setterinherited
onFailure List<DslAction>
final
onSuccess ApiSuccessBuilder?
final
outputAs String?
final
outputType DslType?
no setteroverride
outputVariableName String
no setteroverride
params Map<String, DslExpression>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

buildSuccessActions() List<DslAction>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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