Skip to content

Commit

Permalink
Merge pull request #52 from vanlooverenkoen/bugfix/#49-crash-kiwi-gen…
Browse files Browse the repository at this point in the history
…erator

#49 Fixed by upgrading the dependencies. And setting nullability supp…
  • Loading branch information
vanlooverenkoen authored Oct 2, 2020
2 parents f2d4305 + 47cd4d4 commit 2ce9e0b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ dependencies:

dev_dependencies:
test: ^1.14.7
build_runner: ^1.10.0
build_runner: ^1.10.3
kiwi_generator:
path: ../kiwi_generator
2 changes: 1 addition & 1 deletion flutter_example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.10.0
build_runner: ^1.10.3
kiwi_generator:
path: ../kiwi_generator/

Expand Down
4 changes: 4 additions & 0 deletions kiwi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.1
### Fixed
- Updated dependencies

## 2.0.0
### BREAKING CHANGE
- \#9 Removed the unused T generic for some functions
Expand Down
6 changes: 3 additions & 3 deletions kiwi/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: kiwi
description: A simple yet efficient IoC container for Dart and Flutter (can be coupled with the kiwi_generator package).
version: 2.0.0
version: 2.0.1
homepage: https://github.com/vanlooverenkoen/kiwi/tree/master/kiwi

environment:
sdk: '>=2.2.0 <3.0.0'

dependencies:
meta: ^1.1.8
meta: ^1.2.3

dev_dependencies:
test: ^1.14.7
test: ^1.15.4
4 changes: 4 additions & 0 deletions kiwi_generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.1
### Fixed
- \#49 Fixed a bug that prepares for nullability. In this release we do not yet support nullability. But #51 is tracking nullability support

## 2.0.0
### BREAKING CHANGE
- \#9 Removed the unused T generic for some functions
Expand Down
13 changes: 8 additions & 5 deletions kiwi_generator/lib/src/kiwi_injector_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class KiwiInjectorGenerator extends Generator {
final scopedContainerParam = method.parameters.singleWhere(
(element) =>
element.name == 'scopedContainer' &&
element.type.getDisplayString() == 'KiwiContainer',
element.type.getDisplayString(withNullability: false) ==
'KiwiContainer',
orElse: () => null);

return Method.returnsVoid((mb) {
Expand Down Expand Up @@ -132,9 +133,11 @@ class KiwiInjectorGenerator extends Generator {
final DartType concrete = registerObject.getField('from').toTypeValue();
final DartType concreteType = concrete ?? type;

final String className = concreteType.getDisplayString();
final String typeParameters =
concrete == null ? '' : '<${type.getDisplayString()}>';
final String className =
concreteType.getDisplayString(withNullability: false);
final String typeParameters = concrete == null
? ''
: '<${type.getDisplayString(withNullability: false)}>';

final String nameArgument = name == null ? '' : ", name: '$name'";
final String constructorName =
Expand Down Expand Up @@ -187,7 +190,7 @@ class KiwiInjectorGenerator extends Generator {
) {
final String name = resolvers == null ? null : resolvers[parameter.type];
final String nameArgument = name == null ? '' : "'$name'";
return '${parameter.isNamed ? parameter.name + ': ' : ''}c<${parameter.type.getDisplayString()}>($nameArgument)';
return '${parameter.isNamed ? parameter.name + ': ' : ''}c<${parameter.type.getDisplayString(withNullability: false)}>($nameArgument)';
}

Map<DartType, String> _computeResolvers(
Expand Down
20 changes: 10 additions & 10 deletions kiwi_generator/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: kiwi_generator
description: Generates dependency injection code using the kiwi package to reduce development time.
version: 2.0.0
version: 2.0.1
homepage: https://github.com/vanlooverenkoen/kiwi/tree/master/kiwi_generator

environment:
sdk: '>=2.2.0 <3.0.0'

dependencies:
analyzer: ^0.39.10
build: ^1.3.0
analyzer: ^0.40.4
build: ^1.5.0
build_config: ^0.4.2
code_builder: ^3.3.0
dart_style: ^1.3.6
code_builder: ^3.4.1
dart_style: ^1.3.7
kiwi: ^2.0.0
path: ^1.6.4
source_gen: ^0.9.5
path: ^1.7.0
source_gen: ^0.9.7+1
built_collection: ^4.3.2

dev_dependencies:
build_runner: ^1.10.0
build_test: ^1.2.0
test: ^1.14.7
build_runner: ^1.10.3
build_test: ^1.2.2
test: ^1.15.4

0 comments on commit 2ce9e0b

Please sign in to comment.