Code license (MIT) GitHub release (latest by date) GitHub issues

Injecta is a lightweight Flutter library that provides a simple and efficient service registry for managing dependencies in your Flutter applications. It can be used instead of InheritedWidget or Provider to access objects e.g. from your UI.


To use Injecta in your Flutter project, add the following dependency to your pubspec.yaml file:

  injecta: ^0.2.0

Then, run:

flutter pub get


  1. Create a ServiceRegistry
    Create your registry using ServiceRegistry. Pass a list of functions that create instances of your services to the services parameter.
final services = ServiceRegistry(
    services: [
        () => CounterService(),
  1. Access Services in your Widgets
    Use the context.get<T>() method to access services within your widgets. The services will be lazily initialized and cached.
class _HomeScreenState extends State<HomeScreen> {
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        setState(() {});
      child: Text('${services.get<CounterService>().counter}'),


Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.


Injecta is distributed under the MIT License. See the file for more information.


A simple dependency injection library for Flutter applications.