DEV Community

Pedro Massango
Pedro Massango

Posted on

3

A Container/Dependecy Injection for Flutter apps

In the past few months We made a simple and small Container library to use internally in the company that I'm currentlly working for. It is available in this repository on GitHub. You can try it and leave some feedback. We will keep it up because we are using it for real projects.

Features

  • Create singleton instances;
  • Create factory instances (recreated on every call);
  • Register instances using Module;
  • Get instances from anywhere using the get() function.
  • Logs printed while in DEBUG mode.
  • Easy to test.
  • Doesn't use reflection.

Concepts

  • get() => Used to resolve the instance of a registered class.
  • inject() => Used to resolve a dependency inside a Module.
  • single() => Used to register a singleton instance. You will receive a the same instance every time you use get().
  • factory() => Used to register a factory instance. You will receive a new instance every time you use get().

Read more here and give it a start.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more