ModuleGenerator class


ModuleGenerator for code generation of dependency-injected modules.

ENGLISH This generator scans for Dart classes annotated with @module() and automatically generates boilerplate code for dependency injection (DI) based on the public methods in those classes. Each method can be annotated to describe how an object should be provided to the DI container. The generated code registers those methods as bindings. This automates the creation of factories, singletons, and named instances, reducing repetitive manual code.

RUSSIAN Генератор зависимостей для DI-контейнера на основе аннотаций. Данный генератор автоматически создаёт код для внедрения зависимостей (DI) на основе аннотаций в вашем исходном коде. Когда вы отмечаете класс аннотацией @module(), этот генератор обработает все его публичные методы и автоматически сгенерирует класс с биндингами (регистрациями зависимостей) для DI-контейнера. Это избавляет от написания однообразного шаблонного кода.

Constructors

ModuleGenerator.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
throwOnUnresolved bool
finalinherited
typeChecker → TypeChecker
no setterinherited

Methods

generate(LibraryReader library, BuildStep buildStep) FutureOr<String>
Generates Dart code for an input Dart library.
inherited
generateForAnnotatedElement(Element element, ConstantReader annotation, BuildStep buildStep) String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited