Jonatas

nade onClose sync

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