framework/generator/annotations library
Annotations for Air Framework code generation INNOV-010: Generación de Código con Build Runner
These annotations are used with air_generator package to generate
boilerplate code for states, modules, and events.
Usage
- Add dependencies:
dev_dependencies:
build_runner: ^2.4.0
air_generator: ^1.0.0
- Annotate your classes:
part 'counter_state.g.dart';
@GenerateState('counter')
class CounterState extends _CounterState {
@Pulse() void increment();
@StateFlow() int count = 0;
}
- Run code generation:
dart run build_runner build
Classes
- Computed
- Annotation to mark a computed state
- GenerateEvent
- Annotation to mark a class as an Air event
- GenerateModule
- Annotation to mark a class as an Air module
- GenerateState
- Annotation to mark a class as an Air state
- Inject
- Annotation to inject a dependency
- Pulse
- Annotation to mark a method as a pulse (signal/action)
- Route
- Annotation to mark a method as a route
- StateFlow
- Annotation to mark a field as a flow (reactive state)