enableControls method
void
enableControls()
Resumes notifications to data-aware controls.
When the outermost suspension ends, a saved current record is restored first and at most one deferred notification is then delivered. Throws StateError when no matching disableControls call exists.
Implementation
void enableControls() {
if (_lifecycleCoordinator.isDisposed) {
return;
}
if (_controlsDisableCount == 0) {
throw StateError(
'FdcDataSet.enableControls called without a matching '
'disableControls call.',
);
}
if (_controlsDisableCount > 1) {
_controlsDisableCount--;
return;
}
Object? restoreError;
StackTrace? restoreStackTrace;
try {
_restoreControlsRecord();
} on Object catch (error, stackTrace) {
restoreError = error;
restoreStackTrace = stackTrace;
} finally {
_controlsDisableCount = 0;
_clearControlsRestoreState();
if (_controlsNotificationPending) {
_controlsNotificationPending = false;
super.notifyListeners();
}
}
if (restoreError != null) {
Error.throwWithStackTrace(restoreError, restoreStackTrace!);
}
}