jaspr-fundamentals
Installation
SKILL.md
Components
Jaspr uses a component-based architecture very similar to Flutter's widgets. Concepts like ui composition, architecture and state management are transferable.
- StatelessComponent: For components that don't need mutable state. You must override
Component build(BuildContext context). - StatefulComponent: For components with mutable state. Requires an associated
Stateclass. The state has lifecycle methods likeinitState()anddispose(). You must overrideComponent build(BuildContext context)in the state class. - InheritedComponent: For propagating context or state efficiently down the component tree.
Returning Components from build
Building UIs in Jaspr requires you to return a single Component from build().
- Rule 1: You MUST NOT use
Iterable<Component> build(BuildContext context) sync*. This is legacy code. - Rule 2: You MUST use dot-shorthands instead of capitalized component names for fragments, text, and empty nodes.
- Use
.fragment([...])(Do NOT useFragment([...])orfragment([...])). - Use
.text('...')(Do NOT useText('...')ortext('...')). - Use
.empty()to return an empty space safely.
- Use