mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-26 06:47:20 +00:00
docs(annotations): unify and improve English DartDoc for all DI annotations
- Updated all annotation files with complete English DartDoc, field/class/method usage, practical code samples - Unified documentation style for @inject, @injectable, @instance, @singleton, @named, @scope, @params, @provide, @module - Removed Russian comments for clarity and consistency - Improved discoverability and IDE/autocomplete experience for CherryPick DI users - No functional or API changes; documentation/dev experience only
This commit is contained in:
@@ -11,59 +11,40 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/// ENGLISH:
|
||||
/// Annotation for marking Dart classes or libraries as modules.
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
/// Marks an abstract Dart class as a dependency injection module for CherryPick code generation.
|
||||
///
|
||||
/// Use the `@module()` annotation on abstract classes (or on a library)
|
||||
/// to indicate that the class represents a DI (Dependency Injection) module.
|
||||
/// This is commonly used in code generation tools to automatically register
|
||||
/// and configure dependencies defined within the module.
|
||||
/// Use `@module()` on your abstract class to indicate it provides DI bindings (via provider methods).
|
||||
/// This enables code generation of a concrete module that registers all bindings from your methods.
|
||||
///
|
||||
/// Example:
|
||||
/// Typical usage:
|
||||
/// ```dart
|
||||
/// import 'package:cherrypick_annotations/cherrypick_annotations.dart';
|
||||
///
|
||||
/// @module()
|
||||
/// abstract class AppModule extends Module {
|
||||
/// // Dependency definitions go here.
|
||||
/// abstract class AppModule {
|
||||
/// @singleton()
|
||||
/// Logger provideLogger() => Logger();
|
||||
///
|
||||
/// @named('mock')
|
||||
/// ApiClient mockApi() => MockApiClient();
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// Generates code like:
|
||||
/// The generated code will look like:
|
||||
/// ```dart
|
||||
/// final class $AppModule extends AppModule {
|
||||
/// @override
|
||||
/// void builder(Scope currentScope) {
|
||||
/// // Dependency registration...
|
||||
/// // Dependency registration code...
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// RUSSIAN (Русский):
|
||||
/// Аннотация для пометки классов или библиотек Dart как модуля.
|
||||
///
|
||||
/// Используйте `@module()` для абстрактных классов (или библиотек), чтобы
|
||||
/// показать, что класс реализует DI-модуль (Dependency Injection).
|
||||
/// Обычно используется генераторами кода для автоматической регистрации
|
||||
/// и конфигурирования зависимостей, определённых в модуле.
|
||||
///
|
||||
/// Пример:
|
||||
/// ```dart
|
||||
/// @module()
|
||||
/// abstract class AppModule extends Module {
|
||||
/// // Определения зависимостей
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// Будет сгенерирован код:
|
||||
/// ```dart
|
||||
/// final class $AppModule extends AppModule {
|
||||
/// @override
|
||||
/// void builder(Scope currentScope) {
|
||||
/// // Регистрация зависимостей...
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
// ignore: camel_case_types
|
||||
/// See also: [@provide], [@singleton], [@instance], [@named]
|
||||
@experimental
|
||||
final class module {
|
||||
/// Creates a [module] annotation.
|
||||
/// Creates a [module] annotation for use on a DI module class.
|
||||
const module();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user