doc: added comments to code

This commit is contained in:
Sergey Penkovsky
2025-05-18 00:50:47 +03:00
parent 7bad0c09c0
commit 74f13e3fa4
3 changed files with 73 additions and 4 deletions

View File

@@ -1,4 +1,28 @@
/// An annotation to declare a class as a singleton.
///
/// This can be used to indicate that only one instance of the class
/// should be created, which is often useful in dependency injection
/// frameworks or service locators.
///
/// Example:
/// ```dart
/// @module()
/// abstract class AppModule extends Module {
/// @singleton()
/// Dio dio() => Dio();
/// }
/// ```
/// Сгенерирует код:
/// ```dart
/// final class $AppModule extends AppModule {
/// @override
/// void builder(Scope currentScope) {
/// bind<Dio>().toProvide(() => dio()).singleton();
/// }
/// }
/// ```
// ignore: camel_case_types
class singleton {
final class singleton {
/// Creates a [singleton] annotation.
const singleton();
}