Context
Manages the context for Flet controls, including page reference and auto-update behavior.
Context instance is accessed via flet.context.
Properties
Methods
- 
            auto_update_enabled–Returns whether auto-update is enabled in the current context. 
- 
            disable_auto_update–Disables auto-update behavior for the current context. 
- 
            enable_auto_update–Enables auto-update behavior for the current context. 
- 
            enable_components_mode–Enables components mode in the current context. 
- 
            is_components_mode–Returns whether the current context is in components mode. 
- 
            reset_auto_update–Copies the parent auto-update state into the current context. 
Properties#
property
  
#
page: Page
Returns the current Page associated with the context.
For example:
Returns:
- 
              Page–The current page. 
Raises:
- 
              RuntimeError–If the property is accessed outside a running Flet app. 
Methods#
auto_update_enabled() -> bool
Returns whether auto-update is enabled in the current context.
Returns:
- 
              bool–Trueif auto-update is enabled,Falseotherwise.
    Disables auto-update behavior for the current context.
For example:
import flet as ft
def main(page: ft.Page):
    def button_click():
        ft.context.disable_auto_update()
        b.content = "Button clicked!"
        # update just the button
        b.update()
        page.controls.append(ft.Text("This won't appear"))
        # no page.update() will be called here
    page.controls.append(b := ft.Button("Action!", on_click=button_click))
    # page.update() - auto-update is enabled by default
ft.run(main)
    Enables auto-update behavior for the current context.
For example:
import flet as ft
# disable auto-update globally for the app
ft.context.disable_auto_update()
def main(page: ft.Page):
    # enable auto-update just inside main
    ft.context.enable_auto_update()
    page.controls.append(ft.Text("Hello, world!"))
    # page.update() - we don't need to call it explicitly
ft.run(main)
is_components_mode() -> bool
Returns whether the current context is in components mode.
Returns:
- 
              bool–Trueif in components mode,Falseotherwise.
    Copies the parent auto-update state into the current context.