FLUTTER ECOSYSTEM

injectable_generator

Injectable is a convenient code generator for get_it. Inspired by Angular DI, Guice DI and inject.dart.

Latest version
3.1.3
30-day downloads
471K
Likes
136
Pub points
150

Package Overview

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

Overview

Injectable_generator is a code generation tool for Flutter that simplifies dependency injection using the get_it service locator. Inspired by Angular, Guice, and inject.dart, it enables developers to define dependencies declaratively with annotations. The generator automatically creates boilerplate code for registering and resolving dependencies, improving maintainability and reducing runtime errors. It integrates seamlessly into Flutter projects across macOS, Windows, and Linux platforms.

Use cases
  • Automating dependency registration
  • Simplifying unit testing with mocked dependencies
  • Reducing boilerplate in large-scale apps
  • Enabling clean architecture with dependency injection
  • Managing complex dependency graphs
Key features
  • Annotation-based dependency definition
  • Automatic code generation for get_it
  • Support for lazy and singleton instances
  • Type-safe dependency resolution
  • Integration with build_runner
Suitable for
  • Large Flutter applications
  • Teams using clean architecture
  • Developers seeking reduced boilerplate
  • Projects requiring testable dependency management
  • Apps with complex dependency structures
Considerations
  • Requires build_runner setup
  • Needs understanding of get_it
  • May increase build time
  • Not suitable for simple one-off projects
  • Limited runtime flexibility compared to manual registration
Supported platformsmacOSWindowsLinux

Install package

flutter pub add injectable_generator

Categories

Dependencies

Dependency list 12 items

Source repository

Related projects