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
Tiago da Costa Peixoto
2020-08-08 16:10:03 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
14a5fa09590996282649c201cda00cb5a6ed8a83
14a5fa09
1 parent
b312ca0d
fix typos
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
16 deletions
lib/src/instance/extension_instance.dart
lib/src/instance/get_instance.dart
lib/src/state_manager/rx/rx_getbuilder.dart
lib/src/state_manager/simple/get_state.dart
lib/src/instance/extension_instance.dart
View file @
14a5fa0
...
...
@@ -30,5 +30,5 @@ extension Inst on GetInterface {
Future
<
bool
>
delete
<
S
>({
String
tag
,
String
key
})
async
=>
GetInstance
().
delete
<
S
>(
tag:
tag
,
key:
key
);
bool
isRegist
red
<
S
>({
String
tag
})
=>
GetInstance
().
isRegist
red
<
S
>(
tag:
tag
);
bool
isRegist
ered
<
S
>({
String
tag
})
=>
GetInstance
().
isRegiste
red
<
S
>(
tag:
tag
);
}
...
...
lib/src/instance/get_instance.dart
View file @
14a5fa0
...
...
@@ -155,7 +155,7 @@ class GetInstance {
S
find
<
S
>({
String
tag
,
FcBuilderFunc
<
S
>
instance
})
{
String
key
=
_getKey
(
S
,
tag
);
if
(
isRegistred
<
S
>(
tag:
tag
))
{
if
(
isRegist
e
red
<
S
>(
tag:
tag
))
{
FcBuilder
builder
=
GetConfig
.
_singl
[
key
]
as
FcBuilder
;
if
(
builder
==
null
)
{
if
(
tag
==
null
)
{
...
...
@@ -227,7 +227,7 @@ class GetInstance {
if
(
GetConfig
.
isLogEnable
)
print
(
'[GETX] onClose of
$newKey
called'
);
}
GetConfig
.
_singl
.
removeWhere
((
old
key
,
value
)
=>
(
oldk
ey
==
newKey
));
GetConfig
.
_singl
.
removeWhere
((
old
Key
,
value
)
=>
(
oldK
ey
==
newKey
));
if
(
GetConfig
.
_singl
.
containsKey
(
newKey
))
{
print
(
'[GETX] error on remove object
$newKey
'
);
}
else
{
...
...
@@ -237,8 +237,8 @@ class GetInstance {
return
true
;
}
/// check if instance is registred
bool
isRegistred
<
S
>({
String
tag
})
=>
/// check if instance is registered
bool
isRegistered
<
S
>({
String
tag
})
=>
GetConfig
.
_singl
.
containsKey
(
_getKey
(
S
,
tag
));
/// check if instance is prepared
...
...
@@ -259,7 +259,7 @@ class FcBuilder<S> {
FcBuilder
(
this
.
isSingleton
,
this
.
builderFunc
,
this
.
permanent
,
this
.
isInit
);
S
get
S
ependency
()
{
S
get
D
ependency
()
{
if
(
isSingleton
)
{
if
(
dependency
==
null
)
{
dependency
=
builderFunc
()
as
S
;
...
...
lib/src/state_manager/rx/rx_getbuilder.dart
View file @
14a5fa0
...
...
@@ -42,14 +42,14 @@ class GetImplXState<T extends DisposableInterface> extends State<GetX<T>> {
void
initState
()
{
_observer
=
Rx
();
bool
isPrepared
=
GetInstance
().
isPrepared
<
T
>();
bool
isRegist
red
=
GetInstance
().
isRegist
red
<
T
>();
bool
isRegist
ered
=
GetInstance
().
isRegiste
red
<
T
>();
if
(
widget
.
global
)
{
if
(
isPrepared
)
{
if
(
GetConfig
.
smartManagement
!=
SmartManagement
.
keepFactory
)
{
isCreator
=
true
;
}
controller
=
GetInstance
().
find
<
T
>();
}
else
if
(
isRegistred
)
{
}
else
if
(
isRegist
e
red
)
{
controller
=
GetInstance
().
find
<
T
>();
isCreator
=
false
;
}
else
{
...
...
@@ -89,7 +89,7 @@ class GetImplXState<T extends DisposableInterface> extends State<GetX<T>> {
void
dispose
()
{
if
(
widget
.
dispose
!=
null
)
widget
.
dispose
(
this
);
if
(
isCreator
||
widget
.
assignId
)
{
if
(
widget
.
autoRemove
&&
GetInstance
().
isRegistred
<
T
>())
{
if
(
widget
.
autoRemove
&&
GetInstance
().
isRegist
e
red
<
T
>())
{
GetInstance
().
delete
<
T
>();
}
}
...
...
@@ -100,7 +100,7 @@ class GetImplXState<T extends DisposableInterface> extends State<GetX<T>> {
super
.
dispose
();
}
Widget
get
notifyChild
s
{
Widget
get
notifyChild
ren
{
final
observer
=
getObs
;
getObs
=
_observer
;
final
result
=
widget
.
builder
(
controller
);
...
...
@@ -119,5 +119,5 @@ class GetImplXState<T extends DisposableInterface> extends State<GetX<T>> {
}
@override
Widget
build
(
BuildContext
context
)
=>
notifyChild
s
;
Widget
build
(
BuildContext
context
)
=>
notifyChild
ren
;
}
...
...
lib/src/state_manager/simple/get_state.dart
View file @
14a5fa0
...
...
@@ -205,14 +205,14 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>> {
if
(
widget
.
initState
!=
null
)
widget
.
initState
(
this
);
if
(
widget
.
global
)
{
final
isPrepared
=
GetInstance
().
isPrepared
<
T
>(
tag:
widget
.
tag
);
final
isRegist
red
=
GetInstance
().
isRegist
red
<
T
>(
tag:
widget
.
tag
);
final
isRegist
ered
=
GetInstance
().
isRegiste
red
<
T
>(
tag:
widget
.
tag
);
if
(
isPrepared
)
{
if
(
GetConfig
.
smartManagement
!=
SmartManagement
.
keepFactory
)
{
isCreator
=
true
;
}
controller
=
GetInstance
().
find
<
T
>(
tag:
widget
.
tag
);
}
else
if
(
isRegistred
)
{
}
else
if
(
isRegist
e
red
)
{
controller
=
GetInstance
().
find
<
T
>(
tag:
widget
.
tag
);
isCreator
=
false
;
}
else
{
...
...
@@ -240,7 +240,7 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>> {
super
.
dispose
();
if
(
widget
.
dispose
!=
null
)
widget
.
dispose
(
this
);
if
(
isCreator
||
widget
.
assignId
)
{
if
(
widget
.
autoRemove
&&
GetInstance
().
isRegistred
<
T
>(
tag:
widget
.
tag
))
{
if
(
widget
.
autoRemove
&&
GetInstance
().
isRegist
e
red
<
T
>(
tag:
widget
.
tag
))
{
if
(
remove
!=
null
)
remove
();
GetInstance
().
delete
<
T
>(
tag:
widget
.
tag
);
...
...
@@ -268,7 +268,7 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>> {
if
(
widget
.
didUpdateWidget
!=
null
)
widget
.
didUpdateWidget
(
oldWidget
,
this
);
}
Widget
get
notifyChild
s
{
Widget
get
notifyChild
ren
{
final
old
=
Value
.
_remove
;
Value
.
_remove
=
disposers
;
final
observer
=
Value
.
_setter
;
...
...
@@ -280,7 +280,7 @@ class _GetBuilderState<T extends GetxController> extends State<GetBuilder<T>> {
}
@override
Widget
build
(
BuildContext
context
)
=>
notifyChild
s
;
Widget
build
(
BuildContext
context
)
=>
notifyChild
ren
;
}
class
Value
<
T
>
extends
GetxController
{
...
...
Please
register
or
login
to post a comment