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
Jonatas
2021-02-07 20:29:57 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ae0df647c4f7843b587599c7c2702b02cd5d0b6c
ae0df647
1 parent
3444754f
fix Rx variables out of GetXController memory leak
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
16 deletions
lib/get_connect/http/src/http/mock/http_request_mock.dart
lib/get_navigation/src/extension_navigation.dart
lib/get_navigation/src/snackbar/snack.dart
lib/get_rx/src/rx_types/rx_core/rx_impl.dart
lib/get_connect/http/src/http/mock/http_request_mock.dart
View file @
ae0df64
...
...
@@ -43,7 +43,5 @@ class MockClient extends HttpRequestBase {
}
@override
void
close
()
{
// TODO: implement close
}
void
close
()
{}
}
...
...
lib/get_navigation/src/extension_navigation.dart
View file @
ae0df64
...
...
@@ -31,7 +31,7 @@ extension ExtensionSnackbar on GetInterface {
Color
leftBarIndicatorColor
,
List
<
BoxShadow
>
boxShadows
,
Gradient
backgroundGradient
,
FlatButton
mainButton
,
Widget
mainButton
,
OnTap
onTap
,
Duration
duration
=
const
Duration
(
seconds:
3
),
bool
isDismissible
=
true
,
...
...
lib/get_navigation/src/snackbar/snack.dart
View file @
ae0df64
...
...
@@ -91,8 +91,8 @@ class GetBar<T extends Object> extends StatefulWidget {
/// An option to animate the icon (if present). Defaults to true.
final
bool
shouldIconPulse
;
/// A [FlatButton] widget if you need an action from the user.
final
FlatButton
mainButton
;
/// A [TextButton] widget if you need an action from the user.
final
Widget
mainButton
;
/// A callback that registers the user's click anywhere.
/// An alternative to [mainButton]
...
...
@@ -659,7 +659,7 @@ Set either a message or messageText""");
);
}
FlatButton
_getMainActionButton
()
{
Widget
_getMainActionButton
()
{
return
widget
.
mainButton
;
}
}
...
...
lib/get_rx/src/rx_types/rx_core/rx_impl.dart
View file @
ae0df64
...
...
@@ -116,7 +116,7 @@ mixin RxObjectMixin<T> on NotifyManager<T> {
/// Closing the subscription will happen automatically when the observer
/// Widget ([GetX] or [Obx]) gets unmounted from the Widget tree.
void
bindStream
(
Stream
<
T
>
stream
)
{
_subscriptions
.
add
(
stream
.
listen
((
va
)
=>
value
=
va
));
_subscriptions
[
subject
]
.
add
(
stream
.
listen
((
va
)
=>
value
=
va
));
}
}
...
...
@@ -124,21 +124,19 @@ class RxNotifier<T> = RxInterface<T> with NotifyManager<T>;
mixin
NotifyManager
<
T
>
{
GetStream
<
T
>
subject
=
GetStream
<
T
>();
final
_subscriptions
=
<
StreamSubscription
>[]
;
final
_subscriptions
=
<
GetStream
,
List
<
StreamSubscription
>>{}
;
bool
get
canUpdate
=>
_subscriptions
.
isNotEmpty
;
/// This is an internal method.
/// Subscribe to changes on the inner stream.
void
addListener
(
GetStream
<
T
>
rxGetx
)
{
if
(
_subscriptions
.
contains
(
rxGetx
.
listen
))
{
return
;
if
(!
_subscriptions
.
containsKey
(
rxGetx
))
{
final
subs
=
rxGetx
.
listen
(
subject
.
add
);
final
listSubscriptions
=
_subscriptions
[
rxGetx
]
??=
<
StreamSubscription
>[];
listSubscriptions
.
add
(
subs
);
}
final
subs
=
rxGetx
.
listen
((
data
)
{
subject
.
add
(
data
);
});
_subscriptions
.
add
(
subs
);
}
StreamSubscription
<
T
>
listen
(
...
...
@@ -152,9 +150,12 @@ mixin NotifyManager<T> {
/// Closes the subscriptions for this Rx, releasing the resources.
void
close
()
{
_subscriptions
.
forEach
((
getStream
,
_subscriptions
)
{
for
(
final
subscription
in
_subscriptions
)
{
subscription
?.
cancel
();
}
});
_subscriptions
.
clear
();
subject
.
close
();
}
...
...
Please
register
or
login
to post a comment