ModificationBarrier

Static Class
Provides a mechanism for managing and restricting modifications to the widget hierarchy while ensuring proper handling of callbacks, rebuilds, and disposals during a modification frame.

The barrier represents a reentrant context in which Reconciler actions, disposals, and frame callbacks are collected and executed once the outermost modification frame completes.

Static Fields

MaxCallbacksPerFrame: int
MaxDisposalsPerFrame: int
MaxRebuildsPerFrame: int
UseRuntimeHelper: bool

Static Properties

InsideModification: bool

Static Methods

AddPostFrameCallback(callback: Action): void
Enqueues a callback to be run at the end of the current frame.

Parameters

callback:Action - The action to run at the end of the current frame.
EnqueueHierarchyDisposable(disposable: IHierarchyDisposable): void
Enqueues a disposable to be disposed at the end of the current frame.
Rebuild(element: IWidgetElement): void
Enqueues an element for rebuild.
RemarksWill start a new modification frame using ModificationBarrier.Run if not already inside one.
RemoveHierarchyDisposable(disposable: IHierarchyDisposable): void
RemoveRebuild(element: IWidgetElement): void
Run(action: Action): void
Runs the provided action within the barrier context.
RemarksThis method is safe to call from within another ModificationBarrier.Run or a ModificationBarrier.Rebuild, but not from within a disposal. However, you may enqueue additional disposals from within a disposal callback or add a post-frame callback.

Parameters

action:Action - The action to run within the barrier context.
TryDisposeHierarchyDisposable(disposable: IHierarchyDisposable): void
Tries to dispose of the provided disposable at the earliest possible time.

If currently inside a finalization context, the disposable will be disposed of immediately. Otherwise, it will be enqueued for disposal at the end of the current frame if ModificationBarrier.InsideModification or at the end of the next future frame.

Inherited Members

On this page