dart_service_locator 1.0.5 dart_service_locator: ^1.0.5 copied to clipboard
A lightweight, flexible dependency injection solution for Flutter applications, supporting both synchronous and asynchronous dependency resolution with minimal boilerplate.
Use this package as a library
Depend on it
Run this command:
With Flutter:
$ flutter pub add dart_service_locator
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
dart_service_locator: ^1.0.5
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Import it
Now in your Dart code, you can use:
import 'package:dart_service_locator/dart_service_locator.dart';