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
2020-08-29 21:29:16 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d73b77a52c4da0d03a0720e05d3f453f63c4917f
d73b77a5
1 parent
f7fb3384
added value to RxInterface
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
8 deletions
lib/src/state_manager/rx/rx_impl.dart
lib/src/state_manager/rx/rx_interface.dart
lib/src/state_manager/simple/get_state.dart
lib/src/state_manager/rx/rx_impl.dart
View file @
d73b77a
...
...
@@ -13,12 +13,6 @@ class _RxImpl<T> implements RxInterface<T> {
HashMap
<
Stream
<
T
>,
StreamSubscription
>();
T
_value
;
T
get
value
{
if
(
getObs
!=
null
)
{
getObs
.
addListener
(
subject
.
stream
);
}
return
_value
;
}
/// Common to all Types [T], this operator overloading is using for
/// assignment, same as rx.value
...
...
@@ -143,6 +137,13 @@ class _RxImpl<T> implements RxInterface<T> {
subject
.
add
(
_value
);
}
T
get
value
{
if
(
getObs
!=
null
)
{
getObs
.
addListener
(
subject
.
stream
);
}
return
_value
;
}
Stream
<
T
>
get
stream
=>
subject
.
stream
;
StreamSubscription
<
T
>
listen
(
void
Function
(
T
)
onData
,
...
...
lib/src/state_manager/rx/rx_interface.dart
View file @
d73b77a
...
...
@@ -17,6 +17,10 @@ abstract class RxInterface<T> {
bool
get
canUpdate
;
set
value
(
T
val
);
T
get
value
;
/// Closes the stream
void
close
()
=>
subject
?.
close
();
...
...
@@ -75,7 +79,7 @@ abstract class DisposableInterface {
/// Or dispose objects that can potentially create some memory leaks,
/// like TextEditingControllers, AnimationControllers.
/// Might be useful as well to persist some data on disk.
void
onClose
()
async
{}
Future
<
void
>
onClose
()
async
{}
}
/// Used like [SingleTickerProviderMixin] but only with Get Controllers.
...
...
lib/src/state_manager/simple/get_state.dart
View file @
d73b77a
...
...
@@ -48,7 +48,7 @@ class GetxController extends DisposableInterface {
void
onReady
()
async
{}
@override
void
onClose
()
async
{}
Future
<
void
>
onClose
()
async
{}
}
class
GetBuilder
<
T
extends
GetxController
>
extends
StatefulWidget
{
...
...
Please
register
or
login
to post a comment