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-10-01 10:43:36 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
863b5ad00dda133572af61f72b314764e31e1dba
863b5ad0
1 parent
6abe15ea
nade onClose sync
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
14 deletions
packages/get_instance/lib/src/get_instance.dart
packages/get_instance/lib/src/lifecycle.dart
packages/get_state_manager/lib/src/rx_flutter/rx_disposable.dart
packages/get_instance/lib/src/get_instance.dart
View file @
863b5ad
...
...
@@ -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'
);
}
...
...
packages/get_instance/lib/src/lifecycle.dart
View file @
863b5ad
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
...
...
packages/get_state_manager/lib/src/rx_flutter/rx_disposable.dart
View file @
863b5ad
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
()
{}
}
...
...
Please
register
or
login
to post a comment