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:
- Axis.vertical (default) stacks them top-to-bottom.
- Axis.horizontal arranges them left-to-right.
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:
- AppInstance, the runtime representation of an App during rendering.
- ComponentInstance, the base type for all runtime component instances.
Constructors
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(
) → void - Initializes and runs the app.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited