reacton_generator 0.2.0 copy "reacton_generator: ^0.2.0" to clipboard
reacton_generator: ^0.2.0 copied to clipboard

Code generation for Reacton. Generates serializers, analyzes dependency graphs, and detects dead reactons at build time.

example/example.dart

import 'package:reacton_generator/reacton_generator.dart';

/// A model class annotated for automatic serializer generation.
///
/// Run `dart run build_runner build` to generate `example.reacton.g.dart`
/// containing a `UserReactonSerializer` class.
@ReactonSerializable()
class User {
  final String name;
  final int age;

  User({required this.name, required this.age});

  factory User.fromJson(Map<String, dynamic> json) => User(
        name: json['name'] as String,
        age: json['age'] as int,
      );

  Map<String, dynamic> toJson() => {'name': name, 'age': age};
}

/// Use @ReactonState to add metadata for static graph analysis.
/// The graph analyzer detects reacton declarations automatically,
/// but this annotation enables persistence and DevTools options.
@ReactonState(name: 'currentUser', persistKey: 'user_v1')
final userReacton = null; // placeholder; real usage would import reacton

/// Use @ReactonComputed for computed reacton metadata.
@ReactonComputed(name: 'userDisplay')
final userDisplayReacton = null; // placeholder

void main() {
  print('Reacton Generator - code generation for Reacton');
  print('');
  print('Annotations:');
  print('  @ReactonSerializable()  Auto-generate serializers');
  print('  @ReactonState()         Static graph analysis metadata');
  print('  @ReactonComputed()      Computed reacton metadata');
  print('  @ReactonAsync()         Async reacton metadata');
  print('');
  print('Run: dart run build_runner build');
}
0
likes
150
points
8
downloads

Documentation

API reference

Publisher

verified publishersitharaj.in

Weekly Downloads

Code generation for Reacton. Generates serializers, analyzes dependency graphs, and detects dead reactons at build time.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

analyzer, build, glob, reacton, source_gen

More

Packages that depend on reacton_generator