Skip to main content

ag_flow_generator 0.3.0 copy "ag_flow_generator: ^0.3.0" to clipboard
ag_flow_generator: ^0.3.0 copied to clipboard

build_runner code generator for ag_flow — emits static `find` and `instance` accessors on controllers and services from the @AgInject() annotation, so AgLocator.find<T>() never appears at a call site.

ag_flow_generator #

pub.dev

Optional build_runner code generator for ag_flow.

Annotate a controller or service with @AgInject() and the generator produces a static find or instance accessor so you never write AgLocator.find<T>() at a call site.

// Before
final controller = AgLocator.find<LoginController>();
final service    = AgLocator.find<AuthService>();

// After — Dart infers the type from the left side
final controller = LoginController.find;
final service    = AuthService.instance;

Setup #

Add to pubspec.yaml:

dev_dependencies:
  ag_flow_generator: ^0.1.0
  build_runner: ^2.4.0

Annotate and add the with mixin:

part 'login_controller.g.dart';

@AgInject()
class LoginController extends AgBaseController<User>
    with _$LoginControllerAgInject {
  // LoginController.find is generated automatically
}

Run the generator:

dart run build_runner build

Naming convention #

Base class Generated getter
AgBaseController / AgListController / AgDetailController .find
AgBaseService / AgStateService .instance

The correct getter name is determined automatically from the supertype chain — you never specify it.

Part of the AG Flow ecosystem #

0
likes
130
points
340
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

build_runner code generator for ag_flow — emits static `find` and `instance` accessors on controllers and services from the @AgInject() annotation, so AgLocator.find<T>() never appears at a call site.

Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

Dependencies

ag_flow, analyzer, build, source_gen

More

Packages that depend on ag_flow_generator