injectable_generator
3.1.3Injectable is a convenient code generator for get_it. Inspired by Angular DI, Guice DI and inject.dart.
Readme
injectable_generator
A generator for injectable library.
Changelog
ChangeLog
[3.1.3]
- Chore: update lean_builder to ^1.2.2
[3.1.2]
- Chore: update analyzer constraint to ">=10.0.0 <15.0.0"
- Chore: update lean_builder to ^1.2.1
[3.1.1]
- Chore: decrease injectable_generator minimum analyzer constraint
[3.1.0]
- Fix: avoid import alias collisions in HashedAllocator (#544) by @kmslab20
- Feat: support private named parameters by @jkoenig134
- Chore: update Dart SDK constraint to ">=3.12.0 <4.0.0"
- Chore: update analyzer constraint to ">=10.0.0 <14.0.0"
[3.0.2]
- Fix: update lean_builder to 0.1.9 to sync analyzer version
[3.0.1]
- Fix: update lean_builder to 0.1.9 to sync analyzer version
[3.0.0]
- Breaking: Removed
includeMicroPackagesoption. Micro packages must now be explicitly registered usingexternalPackageModulesBeforeandexternalPackageModulesAfterin@InjectableInit. - Breaking: Removed deprecated
usesNullSafetyoption. Null safety is now always assumed. - Feat: Add support for multiple registrations via
allowMultipleRegistrations(#535, #531). - Fix: Treat external dependencies as non-blocking in environment sorting (#539, Fixes #532).
[2.12.1]
- Chore: Update analyzer constrains to ">=9.0.0 <11.0.0"
[2.12.0]
- Feat: Add optional support for lean_builder package for blazing fast builds
[2.11.1]
- Feat: Add support for
generateAccessorsoption to generate GetIt extension getters - Feat: Improve dependency sorting logic for more predictable registration order
- Feat: Add comprehensive test coverage
- Chore: Update injectable dependency to ^2.7.2
[2.11.0]
- Feat: Add support to cached factories introduced in get_it 8.0.0
[2.10.0]
- Chore: Update dependencies, analyzer (v9), glob (v2.1.3), code_builder (v4.11.0), dart_style (v3.1.3)
[2.9.0]
- Chore: Update dependencies, source_gen (v4), build (v4), analyzer (v8)
- Update dart constrains to ">=3.8.0 <4.0.0"
[2.8.1]
- Fix: Fix @factoryMethod for factory class constructor
[2.8.0]
- Chore: Update dependencies, source_gen (v3), build (v3), build_runner (v2.6)
- Feat: Add generateForEnvironments option
- Fix: fex dependency sort when dependencies have multiple environments
[2.7.0]
- Chore: Update dependencies, source_gen (v2), analyzer (<8.0.0), dart_style (v3)
[2.6.2]
- Feat: Improve Code Generation consistency using hash in alias imports
- Fix: Fix @preResolve only works for methods warning
[2.6.1]
Fix: make register order more predictable to avoid unnecessary code churns in source control by @Adam-Langley
[2.6.0]
Feat: add @ignoreParam annotation to ignore optional parameters in factory methods
[2.5.1]
Fix: Type Alias error on generation #437
[2.5.0]
- Feat: add support for passing records as @factoryParam
[2.4.2]
- Fix Postpone singleton initialisation to respect environment filters by @lrampazzo
[2.4.1]
- Add option to pass instance callback function to the init function by @Adam-Langley
[2.4.0]
- Added [rootDir] support for specifying the root directory for the generation process.
[2.3.0]
- Revert: bumping up collection version to use 1.17.1
- Refactor: the main scope init method will now always be generated even if it has no dependencies
[2.2.0]
- Optimize injectable_generator async analysis by [https://github.com/Jjagg]
- Update dart constrains to ">=3.0.0 <4.0.0"
- Update analyzer constrains to include v6+
[2.1.6]
- Fix const instances are not generated as consts
- update dart constrains to ">=2.17.0 <4.0.0"
- Upgrade some dependencies
[2.1.5]
- Add coverage:ignore-file comment to generated config
- Fix relative imports not working
- Update dependencies (codeBuilder, source_gen)
[2.1.4]
- Fix Scopes - class is registered more than once under the same environment #338
- Fix Injectable unable to detect dependencies from micropackages #341
[2.1.3]
- Fix name of MicroPackageModule contains "_" (is not pascal case) #332
[2.1.2]
- Fix registration order
[2.1.1]
- Fix barrel files related issue
[2.1.0]
- Add support for micro package modules order [before,after]
- Add support for micro package modules scopes
[2.0.1]
- Fix registration order #324
[2.0.0] [Minor breaking changes]
- Add support for micro packages
- Add support for external package modules
- Add support for manual dependencies ordering thanks to @casvanluijtelaar
- Add support for GetIt scopes
- Add @PostConstruct annotation to execute sync/async code after construction
- Add preResolve to @FactoryMethod annotation
- Add throwOnMissingDependencies flag to @InjectableInit annotation
- Change asExtension default value to true [breaking change]
- Change initializerName default value to 'init' [breaking change]
[1.5.5]
- Bump up analyzer version
[1.5.4]
- Bump up analyzer version
[1.5.3]
- Sync injectable and injectable_generator with GetIt v7.2.0 to generate non-nullable @factoryParams
- Migrate to analyzer 3.0.0
[1.5.2]
Fix yet another registration order issue #244
[1.5.1]
Fix auto-async factory bug #237 Fix passing dispose function throws #240 Fix initialization order doesn't respect environments #238 Add generator prints warning when an injected dependency is not available under the same environment
[1.5.0]
Use getAsync for async injected dependencies, fixes #230 Add support for function factory params, fixes #224 Update analyzer version #228 Add ignore types in packages support Fix some readme typos
[1.4.1]
- Bump up build_runner version to 2.0.3
- Fix generator crash when using inline environments #205
[1.4.0]
- Bump up get_it version to range to 7.0.0 <= 8.0.0
- Bump up build_runner version to 2.0.2
[1.3.0]
- Include merge that fixes #194
- Bump up versions of build_runner -> 2.0.1, code_builder -> 4.0.0, analyzer -> 1.5.0
[1.2.2]
- Fix generator crash after 1.2.1 update
- Add option to ignore missing type warning for specified types
[1.2.1]
- Bump up versions of build, build_runner, dart_style and source_gen
- Fix named instances are ignored when sorting dependencies.
- Clean up some code
[1.2.0]
- push nullSafety version to the main section
- Fix sorting by dependents ignores named instances
[1.2.0-nullsafety]
- add null safety support
[1.1.2]
- Add support for disposing of singletons.
- change min version constraint of GetIt to 5.0.0
- update readme file
[1.1.0]
- Refactor code to support null-safety
- Fix preResolved instances conditional registration
- Add option to generate null-safety compatible code to injectableInit
[1.0.7]
- Fix pre-resolved primitives naming issue #161
- Fix some types in readme file
- Fix environments is already registered issue.
[1.0.6]
- Support build_runner v1.10.3
[1.0.5]
- Add support for get_it ^5.0
- Fix analyzer compatibility issues
[1.0.4]
- Add option to customize the initializer function name
- Add option to generate the initializer function as an extension
- Change initializer functions returns the passed get_it instance instead of void
- Add Advanced environment filter that can be extended and customized
- Fix Injectable generator not handling multiple instances of generic types #107
[1.0.3]
- Fix conflict when importing two different types with the same name.
- Improve some warning messages
[1.0.2]
- Fix relative imports issue when file has the same path as target
[1.0.1] Breaking Change
- Fix relative imports issue in test folder
- Change generateForDir property's default value to ['lib']
[1.0.0] Breaking Change
- Add support for multi environments (annotation & inlined)
- Add generation-time check for duplicate dependencies under the same environment
- Fix 3rd party imports from src instead of library file issue
- Change generated file extension to .config.dart
- Change generated file applies to most of effective dart rules including preferring relative imports
- Clean up some code
[0.4.1]
- Fix stack overflow issue #78
[0.4.0] Breaking Changes!
- Change Methods inside of register modules are treated as factory methods now, so all params are considered injected params unless annotated with @factoryParam.
- Change registerModule is now replaced with @module
- Change RegisterAs(Type) Annotation is now replaced with @Injectable(as:Type)
- Change Singleton.Lazy() is replaced with @LazySingleton()
- Add generateForDir property to @InjectableInt to specify what directories to generate for.
- Fix imports issue when working with bin directory
[0.3.5]
- Fix non-primitive factory params aren't imported
[0.3.4]
- fix parameterized dependencies aren't resolved properly
- minor fixes
[0.3.3]
- fix duplicate var names issue when pre-resolving multiple instances of the same type
[0.3.2]
- fix registered abstract dependencies are reported missing.
- fix registering third party types as singleton throws an error.
[0.3.1]
- fix resolve by instanceName is using positional var instead of named
- fix part files are imported as stand alone
- minor fixes
[0.3.0] Breaking Changes!
- add support for GetIt 4.0.0
- fix generic types are registered as dynamic
- fix unresolved future when registering asynchronous dependencies
- change asynchronous dependencies will be registered using async factory unless annotated with @preResolve
[0.2.4]
- fix type arguments are not imported.
- fix get with instanceName missing type.
[0.2.3]
- improve support for custom initializers
- fix src import issue
[0.2.2]
- remove flutter dependency
- add support for custom initializers in register Modules
- minor fixes
[0.2.1]
- fix typo in @Environment annotation
- ignore abstract classes in auto mode.
[0.2.0] Breaking Changes!
- You now need to pass in your getIt instance to @initGetIt() func
- Rename @Bind to @RegisterAs to avoid confusion because, now we're annotating the implementation not the abstract.
- Add @factoryMethod annotation to mark named factories and static create methods.
- Add @registerModule annotation to support registering third party types.
- Fix eager singletons are registered before their dependencies.
[0.1.0]
- initial release
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add injectable_generatorpubspec.yaml
name: injectable_generator
description: Injectable is a convenient code generator for get_it. Inspired by Angular DI, Guice DI and inject.dart.
version: 3.1.3
homepage: https://github.com/Milad-Akarie/injectable
environment:
sdk: ">=3.12.0<4.0.0"
dependencies:
build: ^4.0.4
source_gen: ^4.1.1
path: ^1.9.0
glob: ^2.1.3
analyzer: ">=10.0.0 <15.0.0"
code_builder: ^4.11.0
dart_style: ^3.1.4
lean_builder: ^1.2.2
injectable: ^3.0.0
# path: ../injectable
collection: ^1.18.0
recase: ^4.1.0
meta: ^1.16.0
dev_dependencies:
build_runner: ^2.10.4
build_test: ^3.5.4
test: ^1.28.0
lints: ^6.0.0
coverage: ^1.15.0
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0 | On demand | Download | ab3e8da6…7f06bf |
| 0.2.0 | On demand | Download | 8ca32dbf…5501cc |
| 0.2.1 | On demand | Download | 8d96031a…66a463 |
| 0.2.2 | On demand | Download | 44d59cbc…af1785 |
| 0.2.3 | On demand | Download | b7d3c6f6…58490f |
| 0.2.4 | On demand | Download | d9080001…da53dd |
| 0.3.0 | On demand | Download | 628176a0…9cd4c1 |
| 0.3.1 | On demand | Download | 6ca6359f…9068c0 |
| 0.3.2 | On demand | Download | 1676f008…440502 |
| 0.3.3 | On demand | Download | 215771b0…25509d |
| 0.3.4 | On demand | Download | c156532c…af3a40 |
| 0.3.5 | On demand | Download | 7e84598d…2e108b |
| 0.4.0 | On demand | Download | 5bf983d5…5c39a8 |
| 0.4.1 | On demand | Download | 23c39e6c…696de7 |
| 1.0.0 | On demand | Download | e9900a53…f92f1d |
| 1.0.1 | On demand | Download | 89e5ecd0…734993 |
| 1.0.2 | On demand | Download | d86223c9…e1e7fb |
| 1.0.3 | On demand | Download | 7a201e55…0d7219 |
| 1.0.4 | On demand | Download | b6ce278b…482cf3 |
| 1.0.5 | On demand | Download | 932e7392…566ee6 |
| 1.0.6 | On demand | Download | 7aab84b1…d9f9e2 |
| 1.0.7 | On demand | Download | f66c9f98…d9eb3e |
| 1.1.0 | On demand | Download | 7a473c6d…70d9cf |
| 1.1.1 | On demand | Download | a2632cf8…5329a4 |
| 1.1.2 | On demand | Download | 8ab0832c…5f8c95 |
| 1.2.0-nullsafety | On demand | Download | 53ff2379…4d4166 |
| 1.2.0 | On demand | Download | 6b4b31b6…d5cf0c |
| 1.2.1 | On demand | Download | 41270300…841161 |
| 1.2.2 | On demand | Download | 4fc76855…03e04a |
| 1.3.0 | On demand | Download | 4554cebf…f3520f |
| 1.4.0 | On demand | Download | b165a34e…e28520 |
| 1.4.1 | On demand | Download | 7c739e75…74dc57 |
| 1.5.0 | On demand | Download | 608de295…093357 |
| 1.5.1 | On demand | Download | cef3b4ac…47baeb |
| 1.5.2 | On demand | Download | 17273a74…e9eb60 |
| 1.5.3 | On demand | Download | 42300c16…1d5d13 |
| 1.5.4 | On demand | Download | b9a7e669…2b4b65 |
| 1.5.5 | On demand | Download | 1f5bbe44…130a9d |
| 2.0.0 | On demand | Download | 0973652f…eaf494 |
| 2.0.1 | On demand | Download | fb9e39ba…0f5b37 |
| 2.1.0 | On demand | Download | 180170e2…b01532 |
| 2.1.1 | On demand | Download | 777bfbbd…a900d7 |
| 2.1.2 | On demand | Download | ded3e535…df01a3 |
| 2.1.3 | On demand | Download | 9a3bbd2c…338bc8 |
| 2.1.4 | On demand | Download | b206de63…9a7a09 |
| 2.1.5 | On demand | Download | 0670348c…47a190 |
| 2.1.6 | On demand | Download | 4fe3db04…27b2f3 |
| 2.2.0 | On demand | Download | f6de9716…a76f7c |
| 2.3.0 | On demand | Download | 52dc0769…5c5a0c |
| 2.4.0 | On demand | Download | 5c21787f…ee5905 |
| 2.4.1 | On demand | Download | f9d3c05f…845788 |
| 2.4.2 | On demand | Download | 7fb57311…ac8086 |
| 2.5.0 | On demand | Download | 9d4cf347…5a8a6f |
| 2.5.1 | On demand | Download | ac28d612…d5d41a |
| 2.6.0 | On demand | Download | e1f74e0c…e2f68c |
| 2.6.1 | On demand | Download | 2ca3ada3…d7ba05 |
| 2.6.2 | On demand | Download | af403d76…680ba1 |
| 2.7.0 | On demand | Download | b04673a4…eaea1a |
| 2.8.0 | On demand | Download | 63f0b040…7ea7c1 |
| 2.8.1 | On demand | Download | 09c55dba…b0d5b5 |
| 2.9.0 | On demand | Download | beac1179…495e00 |
| 2.9.1 | On demand | Download | 309c3f35…40d326 |
| 2.10.0 | On demand | Download | ba9fa641…bee95f |
| 2.11.0 | On demand | Download | 0a963606…8abda8 |
| 2.11.1 | On demand | Download | 4a3f3010…e08c4e |
| 2.12.0 | On demand | Download | 5168f818…d96bfb |
| 2.12.1 | On demand | Download | fcc0d1ed…9533c2 |
| 3.0.0 | On demand | Download | 145523f2…1babb6 |
| 3.0.1 | On demand | Download | 983a03cc…f00ec0 |
| 3.0.2 | On demand | Download | 433ad4d9…07ec28 |
| 3.1.0 | Cached · Upstream SHA-256 matched | Download | f4489d28…783e9a |
| 3.1.1 | On demand | Download | 424ea884…a63115 |
| 3.1.2 | On demand | Download | ec0ecd82…ddc0d0 |
| 3.1.3 | Cached · Upstream SHA-256 matched | Download | 24d525c6…2049df |
Dependencies
analyzer "\u003e=10.0.0 \u003c15.0.0"
build "^4.0.4"
code_builder "^4.11.0"
collection "^1.18.0"
dart_style "^3.1.4"
glob "^2.1.3"
injectable "^3.0.0"
lean_builder "^1.2.2"
meta "^1.16.0"
path "^1.9.0"
recase "^4.1.0"
source_gen "^4.1.1"