Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Lifecycle

Every Element moves through a fixed set of lifecycle states, defined as enum Lifecycle in crates/flui-view/src/element/lifecycle.rs:

Initial → Active ⇄ Inactive → Defunct
  • Initial — created but not yet mounted into the tree.
  • Active — mounted, participating in builds, can be marked dirty, has valid parent/child relationships.
  • Inactive — temporarily removed from the tree; state is preserved and the Element may be reactivated within the same frame (its RenderObject, if any, is detached but not disposed).
  • Defunct — permanently removed; the Element will be dropped.

Platform/lifecycle-scoped capabilities — rebuild_handle(), post_frame_handle(), text_input_handle(), focus_manager() — are acquired only while an Element is transitioning through create_state/init_state/did_change_dependencies, never from inside build/perform_layout/paint. They live on LifecycleContext: BuildContext, which only those three hooks receive, so acquiring one in build is a compile error (ADR-0078). See View, Element, RenderObject for BuildContext itself.