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
Frank Moreno
2021-06-13 22:54:40 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b9d377cd514fa98210ee69e0f84f84a2fbe72ef0
b9d377cd
1 parent
7bcdd135
RxInterface.notifyChildren
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
lib/get_rx/src/rx_types/rx_core/rx_interface.dart
lib/get_rx/src/rx_types/rx_core/rx_interface.dart
View file @
b9d377c
...
...
@@ -18,4 +18,23 @@ abstract class RxInterface<T> {
/// Calls [callback] with current value, when the value changes.
StreamSubscription
<
T
>
listen
(
void
Function
(
T
event
)
onData
,
{
Function
?
onError
,
void
Function
()?
onDone
,
bool
?
cancelOnError
});
/// Avoids an unsafe usage of the `proxy`
static
T
notifyChildren
<
T
>(
RxNotifier
observer
,
ValueGetter
<
T
>
builder
)
{
final
_observer
=
RxInterface
.
proxy
;
RxInterface
.
proxy
=
observer
;
final
result
=
builder
();
if
(!
observer
.
canUpdate
)
{
throw
"""
[Get] the improper use of a GetX has been detected.
You should only use GetX or Obx for the specific widget that will be updated.
If you are seeing this error, you probably did not insert any observable variables into GetX/Obx
or insert them outside the scope that GetX considers suitable for an update
(example: GetX => HeavyWidget => variableObservable).
If you need to update a parent widget and a child widget, wrap each one in an Obx/GetX.
"""
;
}
RxInterface
.
proxy
=
_observer
;
return
result
;
}
}
...
...
Please
register
or
login
to post a comment