air_generator 1.0.0 copy "air_generator: ^1.0.0" to clipboard
air_generator: ^1.0.0 copied to clipboard

A robust code generator for the Air Framework that automates state management through Pulses and StateFlows.

example/lib/main.dart

// ignore_for_file: unused_field

import 'package:air_generator/air_generator.dart';

// part 'main.air.g.dart'; // This would be generated

@GenerateState('notifications')
class NotificationsState extends _NotificationsState {
  NotificationsState();

  // Private fields → automatically become StateFlows
  final int _count = 0;
  final bool _isLoading = false;

  // Public void methods → automatically become Pulses
  @override
  void increment() async {
    isLoading = true;
    await Future.delayed(const Duration(seconds: 1));
    isLoading = false;
    count = count + 1;
  }

  @override
  void decrement() {
    count = count - 1;
  }
}

// Mock base class for example purposes (normally generated) into *.air.g.dart
abstract class _NotificationsState {
  set isLoading(bool value) {}
  bool get isLoading => false;
  set count(int value) {}
  int get count => 0;
  void increment();
  void decrement();
}

void main() {
  print('Run build_runner to generate code for NotificationsState.');
}
0
likes
150
points
133
downloads

Publisher

unverified uploader

Weekly Downloads

A robust code generator for the Air Framework that automates state management through Pulses and StateFlows.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, build, source_gen

More

Packages that depend on air_generator