mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-24 13:47:24 +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:
@@ -13,22 +13,30 @@
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
/// Annotation for field injection in CherryPick DI framework.
|
||||
/// Apply this to a field, and the code generator will automatically inject
|
||||
/// the appropriate dependency into it.
|
||||
/// Marks a field for dependency injection by CherryPick's code generator.
|
||||
///
|
||||
/// ---
|
||||
/// Use `@inject()` on fields within a class marked with `@injectable()`.
|
||||
/// Such fields will be automatically injected from the DI [Scope]
|
||||
/// when using the generated mixin or calling `.injectFields()`.
|
||||
///
|
||||
/// Аннотация для внедрения зависимости в поле через фреймворк CherryPick DI.
|
||||
/// Поместите её на поле класса — генератор кода автоматически подставит нужную зависимость.
|
||||
///
|
||||
/// Example / Пример:
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// @inject()
|
||||
/// late final SomeService service;
|
||||
/// import 'package:cherrypick_annotations/cherrypick_annotations.dart';
|
||||
///
|
||||
/// @injectable()
|
||||
/// class LoginScreen with _\$LoginScreen {
|
||||
/// @inject()
|
||||
/// late final AuthService authService;
|
||||
///
|
||||
/// @inject()
|
||||
/// @named('main')
|
||||
/// late final ApiClient api;
|
||||
/// }
|
||||
///
|
||||
/// // After running build_runner, call:
|
||||
/// // LoginScreen().injectFields();
|
||||
/// ```
|
||||
@experimental
|
||||
// ignore: camel_case_types
|
||||
final class inject {
|
||||
const inject();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user