mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
doc: added comments to code
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user