App class Core

The root-level Component of an application.

An App serves as the entry point and container for the entire UI tree. It holds a list of child Components and defines the layout direction (horizontal or vertical) for arranging them.

The layoutDirection determines how the children are laid out:

Example:

final app = App(
  layoutDirection: Axis.vertical, // default
  children: [
    TextComponent('Hello'),
    ButtonComponent(label: 'Click me', onPressed: () {}),
  ],
).run();

The run extension method initializes the terminal screen, builds the layout, configures focus and input handlers, and renders the first frame. See also:

Inheritance
Available extensions

Constructors

App({required List<Component> children, Axis layoutDirection = Axis.vertical})
Creates an App with the given children and an optional layoutDirection (default is Axis.vertical).
const

Properties

children → List<Component>
The list of Components that make up this application’s UI.
final
direction → Axis
Returns the layoutDirection for this App.
no setter
hashCode → int
The hash code for this object.
no setterinherited
layoutDirection → Axis
The direction in which children are arranged.
final
padding → EdgeInsets
The padding inside the component’s layout bounds.
finalinherited
position → Position?
The position of the component within its parent or layout.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createInstance() → ComponentInstance
Creates a ComponentInstance that can be rendered.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run({bool fullScreenMode = false}) → void

Available on App, provided by the AppRunner extension

Initializes and runs the app.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited