Updated container
This commit is contained in:
parent
9dfc847840
commit
d2006816cb
5 changed files with 9 additions and 4 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
# 3.0.2
|
||||||
|
* Resolved static analysis warnings
|
||||||
|
|
||||||
# 3.0.1
|
# 3.0.1
|
||||||
* Updated README
|
* Updated README
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# angel3_container
|
# angel3_container
|
||||||
[![version](https://img.shields.io/badge/pub-v3.0.1-brightgreen)](https://pub.dartlang.org/packages/angel3_container)
|
[![version](https://img.shields.io/badge/pub-v3.0.2-brightgreen)](https://pub.dartlang.org/packages/angel3_container)
|
||||||
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
|
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
|
||||||
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
|
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ class Container {
|
||||||
var constructor = reflectedType.constructors.firstWhere(
|
var constructor = reflectedType.constructors.firstWhere(
|
||||||
(c) => isDefault(c.name),
|
(c) => isDefault(c.name),
|
||||||
orElse: (() => throw ReflectionException(
|
orElse: (() => throw ReflectionException(
|
||||||
'${reflectedType.name} has no default constructor, and therefore cannot be instantiated.')) as ReflectedFunction Function()?);
|
'${reflectedType.name} has no default constructor, and therefore cannot be instantiated.')));
|
||||||
|
|
||||||
for (var param in constructor.parameters) {
|
for (var param in constructor.parameters) {
|
||||||
var value = make(param.type.reflectedType);
|
var value = make(param.type.reflectedType);
|
||||||
|
@ -159,7 +159,8 @@ class Container {
|
||||||
/// type within *this* container will return the result of [f].
|
/// type within *this* container will return the result of [f].
|
||||||
///
|
///
|
||||||
/// Returns [f].
|
/// Returns [f].
|
||||||
T Function(Container) registerFactory<T>(T Function(Container) f, {Type? as}) {
|
T Function(Container) registerFactory<T>(T Function(Container) f,
|
||||||
|
{Type? as}) {
|
||||||
as ??= T;
|
as ??= T;
|
||||||
|
|
||||||
if (_factories.containsKey(as)) {
|
if (_factories.containsKey(as)) {
|
||||||
|
|
|
@ -179,6 +179,7 @@ class _ReflectedClassMirror extends ReflectedClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ReflectedDeclarationMirror extends ReflectedDeclaration {
|
class _ReflectedDeclarationMirror extends ReflectedDeclaration {
|
||||||
|
@override
|
||||||
final String name;
|
final String name;
|
||||||
final dart.MethodMirror mirror;
|
final dart.MethodMirror mirror;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel3_container
|
name: angel3_container
|
||||||
version: 3.0.1
|
version: 3.0.2
|
||||||
description: A hierarchical DI container, and pluggable backends for reflection.
|
description: A hierarchical DI container, and pluggable backends for reflection.
|
||||||
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/container/angel_container
|
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/container/angel_container
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in a new issue