Jonatas

nade onClose sync

@@ -324,13 +324,13 @@ class GetInstance { @@ -324,13 +324,13 @@ class GetInstance {
324 /// - [key] For internal usage, is the processed key used to register 324 /// - [key] For internal usage, is the processed key used to register
325 /// the Instance. **don't use** it unless you know what you are doing. 325 /// the Instance. **don't use** it unless you know what you are doing.
326 /// - [force] Will delete an Instance even if marked as [permanent]. 326 /// - [force] Will delete an Instance even if marked as [permanent].
327 - Future<bool> delete<S>({String tag, String key, bool force = false}) async {  
328 - return _queue.secure<bool>(() { 327 + bool delete<S>({String tag, String key, bool force = false}) {
  328 + // return _queue.secure<bool>(() {
329 return _delete<S>(tag: tag, key: key, force: force); 329 return _delete<S>(tag: tag, key: key, force: force);
330 - }); 330 + // });
331 } 331 }
332 332
333 - Future<bool> _delete<S>({String tag, String key, bool force = false}) async { 333 + bool _delete<S>({String tag, String key, bool force = false}) {
334 final newKey = key ?? _getKey(S, tag); 334 final newKey = key ?? _getKey(S, tag);
335 335
336 if (!_singl.containsKey(newKey)) { 336 if (!_singl.containsKey(newKey)) {
@@ -353,7 +353,7 @@ class GetInstance { @@ -353,7 +353,7 @@ class GetInstance {
353 return false; 353 return false;
354 } 354 }
355 if (i is GetLifeCycle) { 355 if (i is GetLifeCycle) {
356 - await i.onClose(); 356 + i.onClose();
357 Get.log('"$newKey" onClose() called'); 357 Get.log('"$newKey" onClose() called');
358 } 358 }
359 359
1 -import 'dart:async';  
2 -  
3 /// Special callable class to keep the contract of a regular method, and avoid 1 /// Special callable class to keep the contract of a regular method, and avoid
4 /// overrides if you extend the class that uses it, as Dart has no final 2 /// overrides if you extend the class that uses it, as Dart has no final
5 /// methods. 3 /// methods.
@@ -27,7 +25,7 @@ abstract class GetLifeCycle { @@ -27,7 +25,7 @@ abstract class GetLifeCycle {
27 /// Called 1 frame after onInit(). It is the perfect place to enter 25 /// Called 1 frame after onInit(). It is the perfect place to enter
28 /// navigation events, like snackbar, dialogs, or a new route, or 26 /// navigation events, like snackbar, dialogs, or a new route, or
29 /// async request. 27 /// async request.
30 - void onReady() async {} 28 + void onReady() {}
31 29
32 /// Called before [onDelete] method. [onClose] might be used to 30 /// Called before [onDelete] method. [onClose] might be used to
33 /// dispose resources used by the controller. Like closing events, 31 /// dispose resources used by the controller. Like closing events,
@@ -35,7 +33,7 @@ abstract class GetLifeCycle { @@ -35,7 +33,7 @@ abstract class GetLifeCycle {
35 /// Or dispose objects that can potentially create some memory leaks, 33 /// Or dispose objects that can potentially create some memory leaks,
36 /// like TextEditingControllers, AnimationControllers. 34 /// like TextEditingControllers, AnimationControllers.
37 /// Might be useful as well to persist some data on disk. 35 /// Might be useful as well to persist some data on disk.
38 - FutureOr onClose() async {} 36 + void onClose() {}
39 } 37 }
40 38
41 /// Allow track difference between GetxServices and GetxControllers 39 /// Allow track difference between GetxServices and GetxControllers
1 -import 'dart:async';  
2 -  
3 import 'package:flutter/scheduler.dart'; 1 import 'package:flutter/scheduler.dart';
4 import 'package:get_instance/get_instance.dart'; 2 import 'package:get_instance/get_instance.dart';
5 3
@@ -37,7 +35,7 @@ abstract class DisposableInterface extends GetLifeCycle { @@ -37,7 +35,7 @@ abstract class DisposableInterface extends GetLifeCycle {
37 /// navigation events, like snackbar, dialogs, or a new route, or 35 /// navigation events, like snackbar, dialogs, or a new route, or
38 /// async request. 36 /// async request.
39 @override 37 @override
40 - void onReady() async {} 38 + void onReady() {}
41 39
42 /// Called before [onDelete] method. [onClose] might be used to 40 /// Called before [onDelete] method. [onClose] might be used to
43 /// dispose resources used by the controller. Like closing events, 41 /// dispose resources used by the controller. Like closing events,
@@ -46,5 +44,5 @@ abstract class DisposableInterface extends GetLifeCycle { @@ -46,5 +44,5 @@ abstract class DisposableInterface extends GetLifeCycle {
46 /// like TextEditingControllers, AnimationControllers. 44 /// like TextEditingControllers, AnimationControllers.
47 /// Might be useful as well to persist some data on disk. 45 /// Might be useful as well to persist some data on disk.
48 @override 46 @override
49 - FutureOr onClose() async {} 47 + void onClose() {}
50 } 48 }