Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jonny Borges
2021-08-09 19:01:29 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
283d391c52fd8ad4b20ecc699f890c3920deb794
283d391c
1 parent
aea06656
fix multiples dependencies
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
38 deletions
CHANGELOG.md
lib/get_navigation/src/router_report.dart
lib/get_navigation/src/routes/default_route.dart
pubspec.yaml
CHANGELOG.md
View file @
283d391
## [4.3.6]
-
Fix error with autodispose of additional dependencies beyond GetxController
-
Added ability to add your own delegate to RouterOutlet (@steven-spiel)
## [4.3.5]
-
Fix GetConnect timeout (@jasonlaw)
-
Improve Vietnamese docs (@hp1909)
...
...
lib/get_navigation/src/router_report.dart
View file @
283d391
...
...
@@ -7,7 +7,7 @@ import '../../get.dart';
class
RouterReportManager
<
T
>
{
/// Holds a reference to `Get.reference` when the Instance was
/// created to manage the memory.
static
final
Map
<
Route
?,
String
>
_routesKey
=
{};
static
final
Map
<
Route
?,
List
<
String
>
>
_routesKey
=
{};
/// Stores the onClose() references of instances created with `Get.create()`
/// using the `Get.reference`.
...
...
@@ -29,7 +29,12 @@ class RouterReportManager<T> {
/// Links a Class instance [S] (or [tag]) to the current route.
/// Requires usage of `GetMaterialApp`.
static
void
reportDependencyLinkedToRoute
(
String
depedencyKey
)
{
_routesKey
[
_current
]
=
depedencyKey
;
if
(
_current
==
null
)
return
;
if
(
_routesKey
.
containsKey
(
_current
))
{
_routesKey
[
_current
!]!.
add
(
depedencyKey
);
}
else
{
_routesKey
[
_current
]
=
<
String
>[
depedencyKey
];
}
}
static
void
clearRouteKeys
()
{
...
...
@@ -46,9 +51,6 @@ class RouterReportManager<T> {
static
void
reportRouteDispose
(
Route
disposed
)
{
if
(
Get
.
smartManagement
!=
SmartManagement
.
onlyBuilder
)
{
WidgetsBinding
.
instance
!.
addPostFrameCallback
((
_
)
{
///TODO: Check if it's necessary to compare _current != disposed
///Adding it breaks the context Navigation logic,
///as it resolves by Route name.
_removeDependencyByRoute
(
disposed
);
});
}
...
...
@@ -56,11 +58,8 @@ class RouterReportManager<T> {
static
void
reportRouteWillDispose
(
Route
disposed
)
{
final
keysToRemove
=
<
String
>[];
_routesKey
.
forEach
((
key
,
value
)
{
if
(
key
==
disposed
)
{
keysToRemove
.
add
(
value
);
}
});
_routesKey
[
disposed
]?.
forEach
(
keysToRemove
.
add
);
/// Removes `Get.create()` instances registered in `routeName`.
if
(
_routesByCreate
.
containsKey
(
disposed
))
{
...
...
@@ -88,11 +87,8 @@ class RouterReportManager<T> {
/// Meant for internal usage of `GetPageRoute` and `GetDialogRoute`
static
void
_removeDependencyByRoute
(
Route
routeName
)
{
final
keysToRemove
=
<
String
>[];
_routesKey
.
forEach
((
key
,
value
)
{
if
(
key
==
routeName
)
{
keysToRemove
.
add
(
value
);
}
});
_routesKey
[
routeName
]?.
forEach
(
keysToRemove
.
add
);
/// Removes `Get.create()` instances registered in `routeName`.
if
(
_routesByCreate
.
containsKey
(
routeName
))
{
...
...
@@ -108,7 +104,7 @@ class RouterReportManager<T> {
for
(
final
element
in
keysToRemove
)
{
final
value
=
GetInstance
().
delete
(
key:
element
);
if
(
value
)
{
_routesKey
.
remove
(
element
);
_routesKey
[
routeName
]?
.
remove
(
element
);
}
}
...
...
lib/get_navigation/src/routes/default_route.dart
View file @
283d391
...
...
@@ -7,7 +7,22 @@ import 'get_transition_mixin.dart';
import
'route_middleware.dart'
;
import
'transitions_type.dart'
;
class
GetPageRoute
<
T
>
extends
PageRoute
<
T
>
with
GetPageRouteTransitionMixin
<
T
>
{
mixin
PageRouteReportMixin
<
T
>
on
Route
<
T
>
{
@override
void
install
()
{
super
.
install
();
RouterReportManager
.
reportCurrentRoute
(
this
);
}
@override
void
dispose
()
{
super
.
dispose
();
RouterReportManager
.
reportRouteDispose
(
this
);
}
}
class
GetPageRoute
<
T
>
extends
PageRoute
<
T
>
with
GetPageRouteTransitionMixin
<
T
>,
PageRouteReportMixin
{
/// Creates a page route for use in an iOS designed app.
///
/// The [builder], [maintainState], and [fullscreenDialog] arguments must not
...
...
@@ -35,11 +50,7 @@ class GetPageRoute<T> extends PageRoute<T> with GetPageRouteTransitionMixin<T> {
this
.
maintainState
=
true
,
bool
fullscreenDialog
=
false
,
this
.
middlewares
,
})
:
super
(
settings:
settings
,
fullscreenDialog:
fullscreenDialog
)
{
_bla
=
this
;
}
late
Route
_bla
;
})
:
super
(
settings:
settings
,
fullscreenDialog:
fullscreenDialog
);
@override
final
Duration
transitionDuration
;
...
...
@@ -75,23 +86,8 @@ class GetPageRoute<T> extends PageRoute<T> with GetPageRouteTransitionMixin<T> {
final
bool
maintainState
;
@override
void
install
()
{
super
.
install
();
RouterReportManager
.
reportCurrentRoute
(
this
);
}
@override
void
dispose
()
{
super
.
dispose
();
if
(
_bla
!=
this
)
{
throw
'DJHOSIDS'
;
}
RouterReportManager
.
reportRouteDispose
(
this
);
// if (Get.smartManagement != SmartManagement.onlyBuilder) {
// GetInstance().removeDependencyByRoute("$reference");
// }
final
middlewareRunner
=
MiddlewareRunner
(
middlewares
);
middlewareRunner
.
runOnPageDispose
();
}
...
...
pubspec.yaml
View file @
283d391
name
:
get
description
:
Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX.
version
:
4.3.
5
version
:
4.3.
6
homepage
:
https://github.com/jonataslaw/getx
environment
:
...
...
Please
register
or
login
to post a comment