Search packages, repositories and app categories

Package detailsv5.0.1

kiwi

A simple yet efficient dependency injection container for Dart and Flutter (can be coupled with the kiwi_generator package).

AndroidiOSWebmacOSWindowsLinux
30-day downloads
12.7K
Likes
173
Pub points
160

Install package

flutter pub add kiwi

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Kiwi is a lightweight and efficient dependency injection (DI) container for Dart and Flutter, designed to simplify the management of dependencies in applications. It allows developers to register and resolve dependencies with minimal boilerplate, supporting both manual and code-generated registration via the kiwi_generator package. Kiwi integrates seamlessly across all major platforms—Android, iOS, Web, macOS, Windows, and Linux—making it ideal for scalable, maintainable apps. Its simple API promotes clean architecture and testability by enabling easy mocking and replacement of dependencies.

Use cases

  • Managing service dependencies in large-scale Flutter apps
  • Simplifying unit and widget testing with mock dependencies
  • Enabling modular app architecture with clear separation of concerns
  • Supporting dependency lifecycle management
  • Integrating with state management solutions like Provider or Riverpod
  • Facilitating code generation for complex dependency graphs

Key features

  • Lightweight and fast DI container
  • Supports code generation via kiwi_generator
  • Platform-agnostic (works on all Flutter-supported platforms)
  • Easy integration with existing Flutter projects
  • Flexible dependency lifecycle control
  • Clean, readable syntax for dependency registration

Suitable for

  • Flutter developers seeking a simple DI solution
  • Teams building large, maintainable applications
  • Projects requiring robust testing strategies
  • Developers using code generation for improved performance
  • Apps targeting multiple platforms with shared logic

Considerations

  • Requires additional setup for code generation with kiwi_generator
  • May introduce overhead if overused in small projects
  • Learning curve for developers unfamiliar with DI patterns
  • Limited built-in features compared to full-featured DI frameworks
  • Best used in conjunction with other state management approaches

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

kiwi

kiwi kiwi_generator dart_kiwi_example flutter_kiwi_example

Logo

A simple yet efficient IoC container for Dart and Flutter, coupled with a powerful generator to allow you to write less code.

The container does not rely on reflection, it's just a Map, so it's fast.

While using the generator, only constructor injection is supported.

Kiwi

Pub

Source Code

The core package providing the IoC container and the annotations which has no dependencies.

Import it into your pubspec dependencies: section.

Kiwi Generator

Pub

Source Code

The package providing the generator.

Import it into your pubspec dev_dependencies: section.

Dart Kiwi Example

Source Code

An example showing how to setup kiwi and kiwi_generator inside a Dart CLI project.

Flutter Kiwi Example

Source Code

An example showing how to setup kiwi and kiwi_generator inside a Flutter project.

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a new feature, please send a pull request.

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package