Skip to content

Commit

Permalink
Merge pull request #896 from Flutterando/v6.3.0
Browse files Browse the repository at this point in the history
Fix: phantom dependencies.
  • Loading branch information
jacobaraujo7 committed Aug 31, 2023
2 parents 25e7d56 + b838b40 commit edc1919
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
9 changes: 9 additions & 0 deletions flutter_modular/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [6.3.0] - 2023-08-31
- Fix phantom dependencies.
When an instance was registered in an ancestor Module, it was available to its children
automatically. This created comprehension issues when the module was separated from the base app.
Now we recommend creating a global Module, exporting the binds and importing them into the modules.

## [6.1.1] - 2023-08-8
- Fix Exported Dependencies

## [6.1.0+1] - 2023-08-24

- Add: Register and get with keys:
Expand Down
4 changes: 2 additions & 2 deletions flutter_modular/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: flutter_modular
description: Smart project structure with dependency injection and route management
version: 6.1.0+1
version: 6.3.0
homepage: https://github.com/Flutterando/modular

environment:
sdk: ">=3.0.0 <4.0.0"

dependencies:
modular_core: ">=3.1.0 <4.0.0"
modular_core: ">=3.3.0 <4.0.0"
meta: ">=1.3.0 <2.0.0"
result_dart: ">=1.0.4 <2.0.0"
flutter:
Expand Down
2 changes: 1 addition & 1 deletion modular_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 3.1.0+1 - 2023/08/24
## 3.1.1 - 2023/08/24

* fix: Fix Import Modules Dependencies

Expand Down
18 changes: 17 additions & 1 deletion modular_core/lib/src/tracker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class _Tracker implements Tracker {
final AutoInjector injector;

final _disposeTags = <Type, List<String>>{};
final _importedInjector = <String, AutoInjector>{};

Module? _nullableModule;
@override
Expand Down Expand Up @@ -251,11 +252,26 @@ class _Tracker implements Tracker {
return newUrl.join('/');
}

AutoInjector _createExportedInjector(Module importedModule) {
final importTag = importedModule.runtimeType.toString();
late AutoInjector exportedInject;
if (!_importedInjector.containsKey(importTag)) {
exportedInject = _createInjector(importedModule, '${importTag}_Imported');
importedModule.exportedBinds(exportedInject);
} else {
exportedInject = _importedInjector[importTag]!;
}

return exportedInject;
}

AutoInjector _createInjector(Module module, [String? tag]) {
final newInjector = AutoInjector(tag: tag ?? module.runtimeType.toString());
for (final importedModule in module.imports) {
importedModule.exportedBinds(newInjector);
final exportedInject = _createExportedInjector(importedModule);
newInjector.addInjector(exportedInject);
}

module.binds(newInjector);
return newInjector;
}
Expand Down
2 changes: 1 addition & 1 deletion modular_core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: modular_core
description: Smart project structure with dependency injection and route management
version: 3.1.0+1
version: 3.3.0
homepage: https://github.com/Flutterando/modular

environment:
Expand Down

0 comments on commit edc1919

Please sign in to comment.