https://github.com/odroe/single
Singleton mode container to store global singleton resources
https://github.com/odroe/single
Last synced: about 1 year ago
JSON representation
Singleton mode container to store global singleton resources
- Host: GitHub
- URL: https://github.com/odroe/single
- Owner: odroe
- License: bsd-3-clause
- Created: 2020-09-11T20:35:48.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-05-01T14:08:14.000Z (about 2 years ago)
- Last Synced: 2025-07-01T15:13:11.453Z (about 1 year ago)
- Language: Dart
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Single
Singleton mode container to store global singleton resources.
## Installation
- Dart: `dart pub add single`
- Flutter: `flutter pub add single`
## Usage
```dart
import 'package:single/single.dart';
// Add singleton resources
single + () => MyClass();
// Get singleton resources
MyClass myClass = single();
```
## Readmap
- [x] Singleton mode container.
- [x] `+` operator to add singleton resources.
- [x] Callable to get singleton resources.
- [ ] Use annotations to automatically register singletons.
> `Use annotations to automatically register singletons.` Need to learn more about related technologies:
> - `source_gen`? - But this method is not elegant
> - `dart:mirrors`? - This is ideal, but Flutter does not support it! Whether Single really needs to be used in Flutter is still uncertain. We currently use it on the Dart server.
> Here is a reflection example:https://github.com/odroe/single/tree/mirrors However, bugs were encountered during development.
## License
BSD 3-Clause License.
Copyright (c) 2021, [Odroe Inc.](https://odroe.com) All rights reserved.