Skip to content

Commit 86db0c5

Browse files
authored
Merge pull request #564 from Flutterando/fix
version 4.0.1
2 parents 1cbb2d9 + 5865072 commit 86db0c5

File tree

10 files changed

+32
-34
lines changed

10 files changed

+32
-34
lines changed

flutter_modular/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ app.*.map.json
4444
/android/app/debug
4545
/android/app/profile
4646
/android/app/release
47+
48+
49+
# coverage
50+
coverage/

flutter_modular/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
## [4.0.0+11] - 2021-09-16
1+
## [4.0.1] - 2021-09-22
2+
* Fixed pushNamed.
3+
* Fixed bug that allowed access to parameters and arguments in other modules.
4+
* Fixed transitions bug.
5+
6+
## [4.0.0+12] - 2021-09-16
27

38
* New documentation is here! [https://modular.flutterando.com.br](https://modular.flutterando.com.br).
49
* Modular design now uses Layered Architecture (Clean Architecture) with 100% code coverage.

flutter_modular/lib/src/presenter/navigation/modular_router_delegate.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ class ModularRouterDelegate extends RouterDelegate<ModularBook>
8585
for (var disposableRoute in disposableRoutes) {
8686
reportPop.call(disposableRoute);
8787
}
88-
89-
final arguments =
90-
parser.getArguments().getOrElse((l) => ModularArguments.empty());
91-
parser.setArguments(arguments.copyWith(params: {}, data: null));
9288
}
9389

9490
var _lastClick = DateTime.now();
@@ -116,7 +112,11 @@ class ModularRouterDelegate extends RouterDelegate<ModularBook>
116112
final parallel = page.route;
117113
parallel.popCallback?.call(result);
118114
currentConfiguration?.routes.remove(parallel);
119-
reportPop.call(parallel);
115+
if (currentConfiguration?.routes.indexWhere(
116+
(element) => element.uri.toString() == parallel.uri.toString()) ==
117+
-1) {
118+
reportPop.call(parallel);
119+
}
120120
final arguments =
121121
parser.getArguments().getOrElse((l) => ModularArguments.empty());
122122
parser.setArguments(arguments.copyWith(uri: currentConfiguration!.uri));

flutter_modular/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_modular
22
description: Smart project structure with dependency injection and route management
3-
version: 4.0.0+11
3+
version: 4.0.1
44
homepage: https://github.com/Flutterando/modular
55

66
environment:
@@ -9,7 +9,7 @@ environment:
99
dependencies:
1010
flutter_modular_annotations: ^0.0.2
1111
triple: ">=1.3.0+2 <2.0.0"
12-
modular_core: ">=1.0.3 <=2.0.0"
12+
modular_core: ">=1.0.4 <=2.0.0"
1313
meta: ">=1.3.0 <2.0.0"
1414
flutter:
1515
sdk: flutter

modular_core/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## 1.0.0+1 - 2021/09/21
2-
* Fix ordenation routes
1+
## 1.0.4 - 2021/09/22
2+
* Rebuild modularArguments after get route
33
## 1.0.0+1 - 2021/09/05
44
* Stable version
55

modular_core/lib/src/route/tracker.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ class TrackerImpl implements Tracker {
2424

2525
String get currentPath => arguments.uri.toString();
2626

27-
FutureOr<ModularRoute?> findRoute(String path,
28-
{dynamic data, String schema = ''}) async {
27+
FutureOr<ModularRoute?> findRoute(String path, {dynamic data, String schema = ''}) async {
2928
var uri = _resolverPath(path);
3029
final modularKey = ModularKey(schema: schema, name: uri.path);
3130

@@ -41,13 +40,11 @@ class TrackerImpl implements Tracker {
4140
break;
4241
}
4342
}
44-
if (uriCandidate.pathSegments.length != uri.pathSegments.length &&
45-
!uriCandidate.path.contains('**')) {
43+
if (uriCandidate.pathSegments.length != uri.pathSegments.length && !uriCandidate.path.contains('**')) {
4644
continue;
4745
}
4846

49-
if (!(uriCandidate.path.contains(':') ||
50-
uriCandidate.path.contains('**'))) {
47+
if (!(uriCandidate.path.contains(':') || uriCandidate.path.contains('**'))) {
5148
continue;
5249
}
5350

@@ -75,7 +72,7 @@ class TrackerImpl implements Tracker {
7572

7673
if (route == null) return null;
7774

78-
_arguments = arguments.copyWith(data: data, uri: uri, params: params);
75+
_arguments = ModularArguments(uri: uri, data: data, params: params);
7976

8077
return route;
8178
}
@@ -139,6 +136,5 @@ class TrackerImpl implements Tracker {
139136
}
140137

141138
class TrackerNotInitiated extends ModularError {
142-
const TrackerNotInitiated(String message, [StackTrace? stackTrace])
143-
: super(message, stackTrace);
139+
const TrackerNotInitiated(String message, [StackTrace? stackTrace]) : super(message, stackTrace);
144140
}

modular_core/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: modular_core
22
description: Smart project structure with dependency injection and route management
3-
version: 1.0.3
3+
version: 1.0.4
44
homepage: https://github.com/Flutterando/modular
55

66
environment:

modular_core/test/src/route/tracker_test.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ void main() {
3535

3636
route = await ModularTracker.findRoute('/product/test') as CustomRoute?;
3737
expect(route?.uri.path, '/product/test');
38+
expect(ModularTracker.currentPath, '/product/test');
39+
expect(ModularTracker.arguments.params['id'], isNull);
3840
});
3941

4042
test('find route with queries', () async {
@@ -53,8 +55,7 @@ void main() {
5355
});
5456

5557
test('find child route in other module', () async {
56-
var route =
57-
await ModularTracker.findRoute('/other/details') as CustomRoute?;
58+
var route = await ModularTracker.findRoute('/other/details') as CustomRoute?;
5859
expect(route?.uri.path, '/other/details');
5960
expect(route?.parent, '/other/');
6061
expect(route?.data, 'otherWithDetails');
@@ -64,8 +65,7 @@ void main() {
6465
});
6566

6667
test('find child route in deep module', () async {
67-
var route =
68-
await ModularTracker.findRoute('/other/internal/') as CustomRoute?;
68+
var route = await ModularTracker.findRoute('/other/internal/') as CustomRoute?;
6969
expect(route, isNotNull);
7070
ModularTracker.reportPushRoute(route!);
7171
expect(ModularTracker.injector.isModuleAlive<DeepModule>(), true);
@@ -75,8 +75,7 @@ void main() {
7575
ModularTracker.reportPopRoute(route);
7676
expect(ModularTracker.injector.isModuleAlive<DeepModule>(), false);
7777

78-
route =
79-
await ModularTracker.findRoute('/other/internal/deep') as CustomRoute?;
78+
route = await ModularTracker.findRoute('/other/internal/deep') as CustomRoute?;
8079
expect(route, isNotNull);
8180
ModularTracker.reportPushRoute(route!);
8281
expect(ModularTracker.injector.isModuleAlive<DeepModule>(), true);
@@ -92,15 +91,13 @@ void main() {
9291

9392
test('find route with schema', () async {
9493
expect(await ModularTracker.findRoute('/schema'), isNull);
95-
final route = await ModularTracker.findRoute('/schema', schema: 'tag')
96-
as CustomRoute?;
94+
final route = await ModularTracker.findRoute('/schema', schema: 'tag') as CustomRoute?;
9795
expect(route?.uri.path, '/schema');
9896
expect(route?.data, 'withSchema');
9997
});
10098

10199
test('find route with wildcard', () async {
102-
final route =
103-
await ModularTracker.findRoute('/wildcard/test/2') as CustomRoute?;
100+
final route = await ModularTracker.findRoute('/wildcard/test/2') as CustomRoute?;
104101
expect(route?.uri.path, '/wildcard/test/2');
105102
expect(route?.data, 'wildcard');
106103
});

modular_test/lib/modular_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ library modular_test;
22

33
import 'package:modular_core/modular_core.dart';
44

5-
void main() {}
6-
75
void initModule(BindContext module, {List<BindContract> replaceBinds = const []}) {
86
// ignore: invalid_use_of_visible_for_testing_member
97
final bindModules = module.getProcessBinds();

modular_test/test/modular_test_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class MyModule extends RouteContextImpl {
2828
void main() {
2929
final repo = RepoImpl2();
3030

31-
modular_test.main();
32-
3331
modular_test.initModules(
3432
[MyModule()],
3533
replaceBinds: [

0 commit comments

Comments
 (0)