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
Jorge
2020-08-27 16:29:48 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7d7dad661e847498541cb231f4f0540c6072a7ee
7d7dad66
1 parent
74e8cb19
improvement of logging, replaced print method for developer.log
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
lib/src/core/log.dart
lib/src/instance/get_instance.dart
lib/src/core/log.dart
View file @
7d7dad6
import
'package:get/instance_manager.dart'
;
import
'dart:developer'
as
developer
;
typedef
LogWriterCallback
=
void
Function
(
String
text
,
{
bool
isError
});
typedef
LogWriterCallback
=
void
Function
(
String
text
,
{
String
name
,
bool
isError
});
void
defaultLogWriterCallback
(
String
value
,
{
bool
isError
=
false
})
{
if
(
isError
||
GetConfig
.
isLogEnable
)
print
(
value
);
void
defaultLogWriterCallback
(
String
value
,
{
String
name
,
bool
isError
=
false
})
{
if
(
isError
||
GetConfig
.
isLogEnable
)
developer
.
log
(
value
,
name:
name
);
}
...
...
lib/src/instance/get_instance.dart
View file @
7d7dad6
import
'package:flutter/cupertino.dart'
;
import
'package:get/src/core/log.dart'
;
import
'package:get/src/navigation/root/smart_management.dart'
;
import
'package:get/src/state_manager/rx/rx_interface.dart'
;
...
...
@@ -127,7 +128,7 @@ class GetInstance {
if
(
i
is
DisposableInterface
)
{
i
.
onStart
();
GetConfig
.
log
(
'
[GETX]
$key
has been initialized
'
);
GetConfig
.
log
(
'
$key
has been initialized'
,
name:
'[GETX]
'
);
}
}
...
...
@@ -172,7 +173,7 @@ class GetInstance {
if
(!
_factory
.
containsKey
(
key
))
throw
"
$S
not found. You need call put<
$S
>(
$S
()) before"
;
GetConfig
.
log
(
'
[GETX]
$S
instance was created at that time
'
);
GetConfig
.
log
(
'
$S
instance was created at that time'
,
name:
'[GETX]
'
);
S
_value
=
put
<
S
>(
_factory
[
key
].
builder
()
as
S
);
initDependencies
<
S
>(
name:
tag
);
...
...
@@ -216,7 +217,7 @@ class GetInstance {
return
queue
.
add
<
bool
>(()
async
{
if
(!
_singl
.
containsKey
(
newKey
))
{
GetConfig
.
log
(
'
[GETX] Instance
$newKey
already been removed.
'
,
GetConfig
.
log
(
'
Instance
$newKey
already been removed.'
,
name:
'[GETX]
'
,
isError:
true
);
return
false
;
}
...
...
@@ -224,7 +225,8 @@ class GetInstance {
FcBuilder
builder
=
_singl
[
newKey
]
as
FcBuilder
;
if
(
builder
.
permanent
&&
!
force
)
{
GetConfig
.
log
(
'[GETX] [
$newKey
] has been marked as permanent, SmartManagement is not authorized to delete it.'
,
'[
$newKey
] has been marked as permanent, SmartManagement is not authorized to delete it.'
,
name:
'[GETX]'
,
isError:
true
);
return
false
;
}
...
...
@@ -235,14 +237,14 @@ class GetInstance {
}
if
(
i
is
DisposableInterface
)
{
await
i
.
onClose
();
GetConfig
.
log
(
'
[GETX] onClose of
$newKey
called
'
);
GetConfig
.
log
(
'
onClose of
$newKey
called'
,
name:
'[GETX]
'
);
}
_singl
.
removeWhere
((
oldKey
,
value
)
=>
(
oldKey
==
newKey
));
if
(
_singl
.
containsKey
(
newKey
))
{
GetConfig
.
log
(
'
[GETX] error on remove object
$newKey
'
,
isError:
true
);
GetConfig
.
log
(
'
error on remove object
$newKey
'
,
name:
'[GETX]
'
,
isError:
true
);
}
else
{
GetConfig
.
log
(
'
[GETX]
$newKey
deleted from memory
'
);
GetConfig
.
log
(
'
$newKey
deleted from memory'
,
name:
'[GETX]
'
);
}
// _routesKey?.remove(key);
return
true
;
...
...
Please
register
or
login
to post a comment