Library was inspired by 3 other solution:
- Spring Framework
- Dagger 2
- Angular DI builtin library
- Easy and Flexible way of declarative DI approach (DI no service locator);
- Compile time code generation with single output (No need to create special part files every line is in one place);
- Easy scope management.
Annotations and Contract classes for DI #
The core package providing the annotations which describes dependency graph.
No need to import in pubspec. Package finject_flutter using it
The package providing the generator for DI code.
Import it into your pubspec
Flutter glue code #
The package provides glue code which use injecting code under the hood.
Import it into your pubspec
Example showing how to setup dependencies is available here:
MIT License Copyright (c) 2020 Tomasz Król Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- ScopedObject and DisposableScopedObject interfaces added for Disposability feature
- Added Profile Annotation for generating profile specific dependencies
- Injecting with constructor
- Injecting with fields
- Injecting with factory class
- Scoped Singleton
- Custom scopes
- Hierarchcal Search down the tree of widgets
- Named injections
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: finject: ^0.3.0
2. Install it
You can install packages from the command line:
$ pub get
$ flutter pub get
Alternatively, your editor might support
pub get or
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Apr 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.1
- pana: 0.13.6
Health issues and suggestions
Document public APIs. (-0.06 points)
60 out of 62 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.
dartfmt to format