A poor man's dependency injector. This package will allow you to register classes once and have the ability to quickly initialize them. Main goals are to reduce parameter passing and to allow mocking during testing.
Getting Started #
Register a type and it's initialization function. #
Request for the registered type. #
[0.0.1] - Initial publish. #
- initial publish.
- Added example project
- Added method to allow fetching of instance by providing type as parameter
- Simple refactor
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: bargain_di: ^1.0.3
2. Install it
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
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 Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.8.4
- pana: 0.13.15
- Flutter: 1.17.5
Package not compatible with SDK dart
bargain_dithat is a package requiring null.
Health issues and suggestions
Document public APIs. (-1 points)
9 out of 9 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.
lib/bargain_di.dart. (-0.50 points)
lib/bargain_di.dart reported 1 hint:
line 1 col 7: Name types using UpperCamelCase.
flutter format to format
The description is too long. (-10 points)
Search engines display only the first part of the description. Try to keep the value of the
description field in your package's
pubspec.yaml file between 60 and 180 characters.
Maintain an example.
None of the files in the package's
example/ directory matches known example patterns.
Common filename patterns include
bargain_di.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.