flushSync
void
flushSync(
Lets you force React to flush any updates inside the provided callback synchronously.
This ensures that the DOM is updated immediately. Use sparingly as it can hurt performance.
Example:
flushSync(() {
state.set(newValue);
});
// DOM has been updated
Implementation
void flushSync(void Function() callback) {
_reactDomFlushSync(callback.toJS);
}