Skip to content
/ single Public

Singleton mode container to store global singleton resources

License

Notifications You must be signed in to change notification settings

odroe/single

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Single

Singleton mode container to store global singleton resources.

Installation

  • Dart: dart pub add single
  • Flutter: flutter pub add single

Usage

import 'package:single/single.dart';

// Add singleton resources
single + () => MyClass();

// Get singleton resources
MyClass myClass = single<MyClass>();

Readmap

  • Singleton mode container.
  • + operator to add singleton resources.
  • 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. All rights reserved.

About

Singleton mode container to store global singleton resources

Resources

License

Stars

Watchers

Forks

Languages