Showing
6 changed files
with
10 additions
and
2 deletions
@@ -14,7 +14,6 @@ class MyApp extends StatelessWidget { | @@ -14,7 +14,6 @@ class MyApp extends StatelessWidget { | ||
14 | 14 | ||
15 | @override | 15 | @override |
16 | Widget build(BuildContext context) { | 16 | Widget build(BuildContext context) { |
17 | - StreamController(); | ||
18 | return GetMaterialApp( | 17 | return GetMaterialApp( |
19 | debugShowCheckedModeBanner: false, | 18 | debugShowCheckedModeBanner: false, |
20 | enableLog: true, | 19 | enableLog: true, |
@@ -72,12 +72,14 @@ class RxList<E> extends ListMixin<E> | @@ -72,12 +72,14 @@ class RxList<E> extends ListMixin<E> | ||
72 | 72 | ||
73 | /// Replaces all existing items of this list with [item] | 73 | /// Replaces all existing items of this list with [item] |
74 | void assign(E item) { | 74 | void assign(E item) { |
75 | + _value ??= <E>[]; | ||
75 | clear(); | 76 | clear(); |
76 | add(item); | 77 | add(item); |
77 | } | 78 | } |
78 | 79 | ||
79 | /// Replaces all existing items of this list with [items] | 80 | /// Replaces all existing items of this list with [items] |
80 | void assignAll(Iterable<E> items) { | 81 | void assignAll(Iterable<E> items) { |
82 | + _value ??= <E>[]; | ||
81 | clear(); | 83 | clear(); |
82 | addAll(items); | 84 | addAll(items); |
83 | } | 85 | } |
@@ -46,6 +46,7 @@ class RxMap<K, V> extends MapMixin<K, V> | @@ -46,6 +46,7 @@ class RxMap<K, V> extends MapMixin<K, V> | ||
46 | } | 46 | } |
47 | 47 | ||
48 | void assign(K key, V val) { | 48 | void assign(K key, V val) { |
49 | + _value ??= <K, V>{}; | ||
49 | _value.clear(); | 50 | _value.clear(); |
50 | _value[key] = val; | 51 | _value[key] = val; |
51 | refresh(); | 52 | refresh(); |
@@ -53,6 +54,7 @@ class RxMap<K, V> extends MapMixin<K, V> | @@ -53,6 +54,7 @@ class RxMap<K, V> extends MapMixin<K, V> | ||
53 | 54 | ||
54 | void assignAll(Map<K, V> val) { | 55 | void assignAll(Map<K, V> val) { |
55 | if (_value == val) return; | 56 | if (_value == val) return; |
57 | + _value ??= <K, V>{}; | ||
56 | _value = val; | 58 | _value = val; |
57 | refresh(); | 59 | refresh(); |
58 | } | 60 | } |
@@ -41,6 +41,7 @@ class RxSet<E> extends SetMixin<E> | @@ -41,6 +41,7 @@ class RxSet<E> extends SetMixin<E> | ||
41 | 41 | ||
42 | /// Replaces all existing items of this list with [item] | 42 | /// Replaces all existing items of this list with [item] |
43 | void assign(E item) { | 43 | void assign(E item) { |
44 | + _value ??= <E>{}; | ||
44 | clear(); | 45 | clear(); |
45 | add(item); | 46 | add(item); |
46 | } | 47 | } |
@@ -52,6 +53,7 @@ class RxSet<E> extends SetMixin<E> | @@ -52,6 +53,7 @@ class RxSet<E> extends SetMixin<E> | ||
52 | 53 | ||
53 | /// Replaces all existing items of this list with [items] | 54 | /// Replaces all existing items of this list with [items] |
54 | void assignAll(Iterable<E> items) { | 55 | void assignAll(Iterable<E> items) { |
56 | + _value ??= <E>{}; | ||
55 | clear(); | 57 | clear(); |
56 | addAll(items); | 58 | addAll(items); |
57 | } | 59 | } |
1 | name: get | 1 | name: get |
2 | description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with GetX. | 2 | description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with GetX. |
3 | -version: 3.17.0 | 3 | +version: 3.17.1 |
4 | homepage: https://github.com/jonataslaw/getx | 4 | homepage: https://github.com/jonataslaw/getx |
5 | 5 | ||
6 | environment: | 6 | environment: |
-
Please register or login to post a comment