Skip to content

AirView

AirView is the most powerful and efficient way to build reactive UIs in Air Framework. It allows your widgets to respond to state changes with surgical precision.

The magic of AirView lies in its ability to automatically track dependencies. When you access a Flow value inside the builder, AirView takes note.

AirView((context) {
// AirView now knows this widget depends on 'count'
return Text('Count: ${CounterFlows.count.value}');
});

AirView is designed for performance. It follows a simple but strict rule:

It only rebuilds if one of the states it accessed during the last build changes.

If other variables in the same AirController change, but this specific AirView didn’t use them, no rebuild occurs. This ensures that your UI stays fast even as your state grows complex.

FeatureAirBuilderAirView
TrackingManual (via stateKey)Automatic (via access)
GranularitySingle keyMultiple keys / logic-based
Logic SupportBest for simple valuesBest for complex UI logic
  1. Keep it Small: Use small, focused AirView wrappers around specific parts of your UI to minimize rebuild areas.
  2. Access .value inside: Always access the .value of a Flow or StateKey inside the builder function to ensure tracking.
  3. Logic inside is fine: You can perform calculations or conditional logic inside AirView, and it will track every state used in any branch of that logic.