ZenMutation<TData, TVariables> constructor

ZenMutation<TData, TVariables>({
  1. required Future<TData> mutationFn(
    1. TVariables variables
    ),
  2. String? mutationKey,
  3. FutureOr<Object?> onMutate(
    1. TVariables variables
    )?,
  4. void onSuccess(
    1. TData data,
    2. TVariables variables,
    3. Object? context
    )?,
  5. void onError(
    1. Object error,
    2. TVariables variables,
    3. Object? context
    )?,
  6. void onSettled(
    1. TData? data,
    2. Object? error,
    3. TVariables variables,
    4. Object? context,
    )?,
  7. int retryCount = 0,
  8. Duration retryDelay = const Duration(milliseconds: 200),
  9. RetryDelayFn? retryDelayFn,
  10. Duration maxRetryDelay = const Duration(seconds: 30),
  11. double retryBackoffMultiplier = 2.0,
  12. bool exponentialBackoff = true,
  13. bool retryWithJitter = true,
})

Implementation

ZenMutation({
  required this.mutationFn,
  this.mutationKey,
  this.onMutate,
  this.onSuccess,
  this.onError,
  this.onSettled,
  this.retryCount = 0,
  this.retryDelay = const Duration(milliseconds: 200),
  this.retryDelayFn,
  this.maxRetryDelay = const Duration(seconds: 30),
  this.retryBackoffMultiplier = 2.0,
  this.exponentialBackoff = true,
  this.retryWithJitter = true,
}) {
  // AUTOMATIC CHILD CONTROLLER TRACKING
  if (ZenController.currentParentController != null) {
    ZenController.currentParentController!.trackController(this);
  }
}