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-12-26 16:37:13 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
80f7d4901cc880e783b0b102d0c141c581a88b99
80f7d490
1 parent
418a04a5
update GetBuild to accept Object as ID
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
lib/get_state_manager/src/simple/get_controllers.dart
lib/get_state_manager/src/simple/get_state.dart
lib/get_state_manager/src/simple/list_notifier.dart
lib/get_state_manager/src/simple/get_controllers.dart
View file @
80f7d49
...
...
@@ -12,7 +12,7 @@ abstract class GetxController extends DisposableInterface with ListNotifier {
/// `GetBuilder( id: )`,
/// [ids] can be reused among `GetBuilders` like group tags.
/// The update will only notify the Widgets, if [condition] is true.
void
update
([
List
<
String
>
ids
,
bool
condition
=
true
])
{
void
update
([
List
<
Object
>
ids
,
bool
condition
=
true
])
{
if
(!
condition
)
{
return
;
}
...
...
lib/get_state_manager/src/simple/get_state.dart
View file @
80f7d49
...
...
@@ -46,7 +46,7 @@ class _InheritedGetxController<T extends GetxController>
class
GetBuilder
<
T
extends
GetxController
>
extends
StatefulWidget
{
final
GetControllerBuilder
<
T
>
builder
;
final
bool
global
;
final
String
id
;
final
Object
id
;
final
String
tag
;
final
bool
autoRemove
;
final
bool
assignId
;
...
...
@@ -191,4 +191,3 @@ extension ObserverEtx on BuildContext {
return
GetBuilder
.
of
<
T
>(
this
,
rebuild:
true
);
}
}
...
...
lib/get_state_manager/src/simple/list_notifier.dart
View file @
80f7d49
...
...
@@ -19,8 +19,8 @@ class ListNotifier implements Listenable {
List
<
GetStateUpdate
>
_updaters
=
<
GetStateUpdate
>[];
HashMap
<
String
,
List
<
GetStateUpdate
>>
_updatersGroupIds
=
HashMap
<
String
,
List
<
GetStateUpdate
>>();
HashMap
<
Object
,
List
<
GetStateUpdate
>>
_updatersGroupIds
=
HashMap
<
Object
,
List
<
GetStateUpdate
>>();
@protected
void
refresh
()
{
...
...
@@ -44,7 +44,7 @@ class ListNotifier implements Listenable {
}
}
void
_notifyIdUpdate
(
String
id
)
{
void
_notifyIdUpdate
(
Object
id
)
{
if
(
_updatersGroupIds
.
containsKey
(
id
))
{
final
listGroup
=
_updatersGroupIds
[
id
];
for
(
var
item
in
listGroup
)
{
...
...
@@ -54,7 +54,7 @@ class ListNotifier implements Listenable {
}
@protected
void
refreshGroup
(
String
id
)
{
void
refreshGroup
(
Object
id
)
{
assert
(
_debugAssertNotDisposed
());
/// This debounce the call to update.
...
...
@@ -101,7 +101,7 @@ class ListNotifier implements Listenable {
_updaters.remove(listener);
}
void removeListenerId(
String
id, VoidCallback listener) {
void removeListenerId(
Object
id, VoidCallback listener) {
assert(_debugAssertNotDisposed());
if (_updatersGroupIds.containsKey(id)) {
_updatersGroupIds[id].remove(listener);
...
...
@@ -123,7 +123,7 @@ class ListNotifier implements Listenable {
return () => _updaters.remove(listener);
}
Disposer addListenerId(
String
key, GetStateUpdate listener) {
Disposer addListenerId(
Object
key, GetStateUpdate listener) {
_updatersGroupIds[key] ??= <GetStateUpdate>[];
_updatersGroupIds[key].add(listener);
return () => _updatersGroupIds[key].remove(listener);
...
...
@@ -132,7 +132,7 @@ class ListNotifier implements Listenable {
/// To dispose an [id] from future updates(), this ids are registered
/// by [GetBuilder()] or similar, so is a way to unlink the state change with
/// the Widget from the Controller.
void disposeId(
String
id) {
void disposeId(
Object
id) {
_updatersGroupIds.remove(id);
}
}
...
...
Please
register
or
login
to post a comment