Showing
5 changed files
with
35 additions
and
4 deletions
1 | +## [3.25.1] - Big update | ||
2 | +- Improved the log system to display the tag used in the controller that was created. | ||
3 | + | ||
1 | ## [3.25.0] - Big update | 4 | ## [3.25.0] - Big update |
2 | - Added [reload] and [reloadAll] methods to reload your Controller to original values | 5 | - Added [reload] and [reloadAll] methods to reload your Controller to original values |
3 | - Added [FullLifeCycleController] - A GetxController capable of observing all the life cycles of your application. FullLifeCycleController has the life cycles: | 6 | - Added [FullLifeCycleController] - A GetxController capable of observing all the life cycles of your application. FullLifeCycleController has the life cycles: |
@@ -61,6 +61,7 @@ linter: | @@ -61,6 +61,7 @@ linter: | ||
61 | avoid_catches_without_on_clauses: true # avoid | 61 | avoid_catches_without_on_clauses: true # avoid |
62 | avoid_catching_errors: true | 62 | avoid_catching_errors: true |
63 | use_rethrow_when_possible: true | 63 | use_rethrow_when_possible: true |
64 | + unrelated_type_equality_checks: true | ||
64 | 65 | ||
65 | # DESIGN | 66 | # DESIGN |
66 | use_to_and_as_if_applicable: true # prefer | 67 | use_to_and_as_if_applicable: true # prefer |
@@ -187,6 +187,7 @@ class GetInstance { | @@ -187,6 +187,7 @@ class GetInstance { | ||
187 | permanent, | 187 | permanent, |
188 | false, | 188 | false, |
189 | fenix, | 189 | fenix, |
190 | + name, | ||
190 | ), | 191 | ), |
191 | ); | 192 | ); |
192 | } | 193 | } |
@@ -287,7 +288,11 @@ class GetInstance { | @@ -287,7 +288,11 @@ class GetInstance { | ||
287 | if (i is GetLifeCycleBase) { | 288 | if (i is GetLifeCycleBase) { |
288 | if (i.onStart != null) { | 289 | if (i.onStart != null) { |
289 | i.onStart(); | 290 | i.onStart(); |
290 | - Get.log('"$key" has been initialized'); | 291 | + if (tag == null) { |
292 | + Get.log('Instance "$S" has been initialized'); | ||
293 | + } else { | ||
294 | + Get.log('Instance "$S" with tag "$tag" has been initialized'); | ||
295 | + } | ||
291 | } | 296 | } |
292 | if (!_singl[key].isSingleton && i.onDelete != null) { | 297 | if (!_singl[key].isSingleton && i.onDelete != null) { |
293 | _routesByCreate[Get.reference] ??= HashSet<Function>(); | 298 | _routesByCreate[Get.reference] ??= HashSet<Function>(); |
@@ -495,16 +500,35 @@ class _InstanceBuilderFactory<S> { | @@ -495,16 +500,35 @@ class _InstanceBuilderFactory<S> { | ||
495 | 500 | ||
496 | bool isInit = false; | 501 | bool isInit = false; |
497 | 502 | ||
503 | + String tag; | ||
504 | + | ||
498 | _InstanceBuilderFactory( | 505 | _InstanceBuilderFactory( |
499 | this.isSingleton, | 506 | this.isSingleton, |
500 | this.builderFunc, | 507 | this.builderFunc, |
501 | this.permanent, | 508 | this.permanent, |
502 | this.isInit, | 509 | this.isInit, |
503 | this.fenix, | 510 | this.fenix, |
511 | + this.tag, | ||
504 | ); | 512 | ); |
505 | 513 | ||
514 | + void _showInitLog() { | ||
515 | + if (tag == null) { | ||
516 | + Get.log('Instance "$S" has been created'); | ||
517 | + } else { | ||
518 | + Get.log('Instance "$S" has been created with tag "$tag"'); | ||
519 | + } | ||
520 | + } | ||
521 | + | ||
506 | /// Gets the actual instance by it's [builderFunc] or the persisted instance. | 522 | /// Gets the actual instance by it's [builderFunc] or the persisted instance. |
507 | S getDependency() { | 523 | S getDependency() { |
508 | - return isSingleton ? dependency ??= builderFunc() : builderFunc(); | 524 | + if (isSingleton) { |
525 | + if (dependency == null) { | ||
526 | + _showInitLog(); | ||
527 | + dependency = builderFunc(); | ||
528 | + } | ||
529 | + return dependency; | ||
530 | + } else { | ||
531 | + return builderFunc(); | ||
532 | + } | ||
509 | } | 533 | } |
510 | } | 534 | } |
@@ -104,9 +104,12 @@ extension MapExtension<K, V> on Map<K, V> { | @@ -104,9 +104,12 @@ extension MapExtension<K, V> on Map<K, V> { | ||
104 | } | 104 | } |
105 | 105 | ||
106 | void assignAll(Map<K, V> val) { | 106 | void assignAll(Map<K, V> val) { |
107 | + if (val is RxMap && this is RxMap) { | ||
108 | + if ((val as RxMap)._value == (this as RxMap)._value) return; | ||
109 | + } | ||
107 | if (this is RxMap) { | 110 | if (this is RxMap) { |
108 | final map = (this as RxMap); | 111 | final map = (this as RxMap); |
109 | - if (map._value == val || map == val) return; | 112 | + if (map._value == val) return; |
110 | map._value = val; | 113 | map._value = val; |
111 | map.refresh(); | 114 | map.refresh(); |
112 | } else { | 115 | } else { |
1 | name: get | 1 | name: get |
2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. | 2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. |
3 | -version: 3.25.0 | 3 | +version: 3.25.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