withoutNotifying<T> method

Future<T> withoutNotifying<T>(
  1. Future<T> action()
)

Execute action without triggering UI notifications.

All setLoading, setSuccess, setError, handleApiError, and clearErrors calls within action will update internal state but skip notifyListeners, preventing full-page rebuilds.

Use when form-level loading (via MagicFormData.process) already drives the submit button's loading indicator.

await form.process(() => controller.withoutNotifying(
    () => controller.doUpdateProfile(name: 'Alice', email: 'a@b.com'),
));

Implementation

Future<T> withoutNotifying<T>(Future<T> Function() action) async {
  _suppressionDepth++;
  try {
    return await action();
  } finally {
    _suppressionDepth--;
  }
}