ContextLifecycleExtensions extension
Extensions for lifecycle and frame scheduling from BuildContext.
Example:
context.onPostFrame(() { /* do something after build */ });
context.onPostFrames(3, () { /* do something after 3 frames */ });
- on
Properties
- isContextMounted → bool
-
Available on BuildContext, provided by the ContextLifecycleExtensions extension
Returns true if this BuildContext is still mounted in the widget tree.no setter
Methods
-
ifMounted(
VoidCallback callback) → void -
Available on BuildContext, provided by the ContextLifecycleExtensions extension
Runscallbackonly if this BuildContext is still mounted. -
onPostFrame(
VoidCallback callback) → void -
Available on BuildContext, provided by the ContextLifecycleExtensions extension
Runs a callback after the current frame is rendered. -
onPostFrameIfMounted(
VoidCallback callback) → void -
Available on BuildContext, provided by the ContextLifecycleExtensions extension
Runs a callback after the current frame, but only if the context is still mounted at the time of execution. -
onPostFrames(
int count, VoidCallback callback) → void -
Available on BuildContext, provided by the ContextLifecycleExtensions extension
Runs a callback aftercountframes have been rendered.