Skip to content

Commit 12aff6e

Browse files
committed
minor refactor
1 parent 8f0a1cd commit 12aff6e

5 files changed

Lines changed: 25 additions & 27 deletions

File tree

lib/src/navigator/route_navigator_extension.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,24 @@ extension RouteNavigatorExtension on BuildContext {
131131

132132
return route != null && route.isFirst;
133133
}
134+
135+
/// Restores a single route from stored settings.
136+
Route? restoreRoute() => Control.get<RouteStore>()?.routing.restore(this);
137+
138+
/// Restores a route and its sub-routes from stored settings and navigates to them.
139+
Future<dynamic> restoreNavigation([
140+
List<dynamic> subRoutes = const [],
141+
]) async =>
142+
Control.get<RouteStore>()
143+
?.routing
144+
.restoreRouteNavigation(this, navigator, subRoutes);
145+
}
146+
147+
/// Extension on [RootContext] for routing.
148+
extension RootContextRouterExt on RootContext {
149+
/// Generates a route, with a special case for the root ('/') route.
150+
Route? generateRoute(RouteSettings settings, {Route Function()? root}) =>
151+
(settings.name == '/' && root != null)
152+
? root.call()
153+
: Control.get<RouteStore>()?.routing.generate(this, settings);
134154
}

lib/src/navigator/route_store.dart

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class RouteMask {
341341
}
342342

343343
class _PathSegment {
344-
static RegExp _mask = RegExp('{.*}');
344+
static final RegExp _mask = RegExp('{.*}');
345345

346346
final String name;
347347
final bool mask;
@@ -527,25 +527,3 @@ class RoutingProvider {
527527
return null;
528528
}
529529
}
530-
531-
/// Extension on [RootContext] for routing.
532-
extension RootContextRouterExt on RootContext {
533-
/// Generates a route, with a special case for the root ('/') route.
534-
Route? generateRoute(RouteSettings settings, {Route Function()? root}) =>
535-
(settings.name == '/' && root != null)
536-
? root.call()
537-
: Control.get<RouteStore>()?.routing.generate(this, settings);
538-
}
539-
540-
/// Extension on [CoreContext] for routing.
541-
extension BuildContextRouterExt on CoreContext {
542-
/// Restores a single route from stored settings.
543-
Route? restoreRoute() => Control.get<RouteStore>()?.routing.restore(this);
544-
545-
/// Restores a route and its sub-routes from stored settings and navigates to them.
546-
Future<dynamic> restoreNavigation(
547-
[List<dynamic> subRoutes = const []]) async =>
548-
Control.get<RouteStore>()
549-
?.routing
550-
.restoreRouteNavigation(this, navigator, subRoutes);
551-
}

modules/control_config/lib/src/pref_model.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PrefModelBase<T, U> extends ControlModel with NotifierComponent {
2626

2727
/// Sets a new value for the preference.
2828
/// This updates the stored preference and notifies all listeners via [notify()].
29-
set value(T? value) {
29+
set value(dynamic value) {
3030
_set(value as U);
3131
notify();
3232
}

modules/control_config/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: control_config
22
description: Wrapper around shared_preferences
33
repository: https://github.com/romanbase/flutter_control
4-
version: 1.4.0-beta.2
4+
version: 1.4.0-beta.3
55

66
environment:
77
sdk: '>=3.0.0 <4.0.0'

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: flutter_control
22
description: Flutter Control is complex library to maintain App and State management, Dependency Injection, Navigation with Routing, Localization and more..
33
repository: https://github.com/romanbase/flutter_control
4-
version: 4.2.1-beta.2
4+
version: 4.2.1-beta.3
55

66
environment:
77
sdk: '>=3.0.0 <4.0.0'
@@ -15,7 +15,7 @@ dependencies:
1515
control_core: ">=2.0.0-beta.2 <3.0.0"
1616

1717
# https://pub.dev/packages/control_config
18-
control_config: ">=1.4.0-beta.2 <2.0.0"
18+
control_config: ">=1.4.0-beta.3 <2.0.0"
1919

2020
dev_dependencies:
2121
flutter_test:

0 commit comments

Comments
 (0)