dependon 0.0.2 dependon: ^0.0.2 copied to clipboard
Dependency injection management.
A simple light-weight dependency injection manager for Flutter.
Features #
- Global dependency injection accross the application.
- Lazy initialization.
- Simple and light-weight.
- Ready-to-go.
Getting started #
- Add the dependency to your
pubspec.yaml
. - Setup your components at the start of your application:
import 'package:dependon/dependon.dart';
factory(() => UserProvider());
singleton<UserRepository>(() => UserRepositoryImpl(get()));
- Use it wherever you want.
import 'package:dependon/dependon.dart';
final UserRepository userRepository = get();
// or
final userRepository = get<UserRepository>();
Usage #
import 'package:dependon/dependon.dart';
void main() async {
factory(() => UserProvider());
singleton<UserRepository>(() => UserRepositoryImpl(get()));
// retrieve instance
final UserRepository userRepository = get();
}
Additional information #
This is an alpha release and this package is still in development. Not recommended for production.