added documentations

This commit is contained in:
Sergey Penkovsky
2025-05-22 13:52:56 +03:00
parent 7490a8e66b
commit 9bbfe2a726
3 changed files with 65 additions and 0 deletions

View File

@@ -11,6 +11,31 @@
// limitations under the License.
//
/// An annotation to indicate that a method provides a dependency to the module.
///
/// This annotation is typically used in conjunction with dependency injection,
/// marking methods whose return value should be registered as a provider.
/// The annotated method can optionally declare dependencies as parameters,
/// which will be resolved and injected automatically.
///
/// Example:
/// ```dart
/// @module()
/// abstract class AppModule extends Module {
/// @provide()
/// Foo foo(Bar bar) => Foo(bar);
/// }
/// ```
///
/// This will generate:
/// ```dart
/// final class $AppModule extends AppModule {
/// @override
/// void builder(Scope currentScope) {
/// bind<Foo>().toProvide(() => foo(currentScope.resolve<Bar>()));
/// }
/// }
/// ```
// ignore: camel_case_types
final class provide {
const provide();