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
Jonny Borges
2021-03-04 11:23:49 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bd2055073ad25c5e4c99a90e27aceab2d3e0ea39
bd205507
1 parent
0f0d3d1f
release ready
Show whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
200 additions
and
260 deletions
lib/get_connect/connect.dart
lib/get_connect/http/src/http.dart
lib/get_connect/http/src/http/html/http_request_html.dart
lib/get_connect/http/src/http/io/http_request_io.dart
lib/get_connect/http/src/http/mock/http_request_mock.dart
lib/get_connect/http/src/multipart/form_data.dart
lib/get_connect/http/src/multipart/multipart_file.dart
lib/get_connect/sockets/sockets.dart
lib/get_connect/sockets/src/sockets_io.dart
lib/get_connect/sockets/src/sockets_stub.dart
lib/get_instance/src/extension_instance.dart
lib/get_instance/src/get_instance.dart
lib/get_navigation/src/bottomsheet/bottomsheet.dart
lib/get_navigation/src/dialog/dialog_route.dart
lib/get_navigation/src/extension_navigation.dart
lib/get_navigation/src/routes/default_route.dart
lib/get_navigation/src/routes/get_route.dart
lib/get_navigation/src/routes/observers/route_observer.dart
lib/get_navigation/src/routes/route_middleware.dart
lib/get_navigation/src/snackbar/snack.dart
lib/get_navigation/src/snackbar/snack_route.dart
lib/get_rx/src/rx_stream/mini_stream.dart
lib/get_rx/src/rx_stream/rx_stream.dart
lib/get_rx/src/rx_types/rx_core/rx_num.dart
lib/get_rx/src/rx_types/rx_iterables/rx_list.dart
lib/get_rx/src/rx_types/rx_iterables/rx_map.dart
lib/get_rx/src/rx_types/rx_iterables/rx_set.dart
lib/get_rx/src/rx_workers/rx_workers.dart
lib/get_state_manager/src/rx_flutter/rx_getx_widget.dart
lib/get_state_manager/src/rx_flutter/rx_notifier.dart
lib/get_state_manager/src/simple/get_state.dart
lib/get_state_manager/src/simple/get_widget_cache.dart
lib/get_state_manager/src/simple/mixin_state.dart
lib/get_state_manager/src/simple/simple_builder.dart
lib/get_utils/src/extensions/internacionalization.dart
lib/get_utils/src/get_utils/get_utils.dart
test/benchmarks/benckmark_test.dart
test/navigation/root_widget_test.dart
test/navigation/routes_test.dart
test/rx/rx_workers_test.dart
test/state_manager/get_state_test.dart
lib/get_connect/connect.dart
View file @
bd20550
...
...
@@ -262,7 +262,7 @@ class GetConnect extends GetConnectInterface {
})
{
_checkIfDisposed
(
isHttp:
false
);
final
_socket
=
GetSocket
(
_concatUrl
(
url
),
ping:
ping
);
final
_socket
=
GetSocket
(
_concatUrl
(
url
)
!
,
ping:
ping
);
sockets
.
add
(
_socket
);
return
_socket
;
}
...
...
lib/get_connect/http/src/http.dart
View file @
bd20550
import
'dart:async'
;
import
'dart:convert'
;
import
'package:flutter/foundation.dart'
;
import
'../src/certificates/certificates.dart'
;
import
'../src/exceptions/exceptions.dart'
;
...
...
lib/get_connect/http/src/http/html/http_request_html.dart
View file @
bd20550
...
...
@@ -38,6 +38,7 @@ class HttpRequestImpl implements HttpRequestBase {
..
responseType
=
'blob'
..
withCredentials
=
withCredentials
;
request
.
headers
.
forEach
(
xhr
.
setRequestHeader
);
request
.
contentLength
??
-
1
;
var
completer
=
Completer
<
Response
<
T
>>();
xhr
.
onLoad
.
first
.
then
((
_
)
{
...
...
lib/get_connect/http/src/http/io/http_request_io.dart
View file @
bd20550
...
...
@@ -32,7 +32,7 @@ class HttpRequestImpl extends HttpRequestBase {
@override
Future
<
Response
<
T
>>
send
<
T
>(
Request
<
T
>
request
)
async
{
Stream
<
List
<
int
>?>
stream
=
request
.
bodyBytes
.
asBroadcastStream
();
var
stream
=
request
.
bodyBytes
.
asBroadcastStream
();
//var stream = BodyBytesStream.fromBytes(requestBody ?? const []);
try
{
...
...
lib/get_connect/http/src/http/mock/http_request_mock.dart
View file @
bd20550
...
...
@@ -16,7 +16,7 @@ class MockClient extends HttpRequestBase {
@override
Future
<
Response
<
T
>>
send
<
T
>(
Request
<
T
>
request
)
async
{
var
requestBody
=
await
request
.
bodyBytes
.
toBytes
();
var
bodyBytes
=
BodyBytesStream
.
fromBytes
(
requestBody
??
const
[]
);
var
bodyBytes
=
BodyBytesStream
.
fromBytes
(
requestBody
);
var
response
=
await
_handler
(
request
);
...
...
lib/get_connect/http/src/multipart/form_data.dart
View file @
bd20550
...
...
@@ -57,9 +57,7 @@ class FormData {
String
_fileHeader
(
MapEntry
<
String
,
MultipartFile
>
file
)
{
var
header
=
'content-disposition: form-data; name="
${browserEncode(file.key)}
"'
;
if
(
file
.
value
.
filename
!=
null
)
{
header
=
'
$header
; filename="
${browserEncode(file.value.filename)}
"'
;
}
header
=
'
$header
\r\n
'
'content-type:
${file.value.contentType}
'
;
return
'
$header
\r\n\r\n
'
;
...
...
lib/get_connect/http/src/multipart/multipart_file.dart
View file @
bd20550
import
'package:flutter/foundation.dart'
;
import
'../http/stub/file_decoder_stub.dart'
if
(
dart
.
library
.
html
)
'../http/html/file_decoder_html.dart'
if
(
dart
.
library
.
io
)
'../http/io/file_decoder_io.dart'
;
...
...
lib/get_connect/sockets/sockets.dart
View file @
bd20550
...
...
@@ -3,7 +3,7 @@ import 'src/sockets_stub.dart'
if
(
dart
.
library
.
io
)
'src/sockets_io.dart'
;
class
GetSocket
extends
BaseWebSocket
{
GetSocket
(
String
?
url
,
GetSocket
(
String
url
,
{
Duration
ping
=
const
Duration
(
seconds:
5
),
bool
allowSelfSigned
=
true
})
:
super
(
url
,
ping:
ping
,
allowSelfSigned:
allowSelfSigned
);
}
...
...
lib/get_connect/sockets/src/sockets_io.dart
View file @
bd20550
...
...
@@ -54,7 +54,8 @@ class BaseWebSocket {
return
;
}
on
SocketException
catch
(
e
)
{
connectionStatus
=
ConnectionStatus
.
closed
;
socketNotifier
!.
notifyError
(
Close
(
e
.
osError
!.
message
,
e
.
osError
!.
errorCode
));
socketNotifier
!
.
notifyError
(
Close
(
e
.
osError
!.
message
,
e
.
osError
!.
errorCode
));
return
;
}
}
...
...
lib/get_connect/sockets/src/sockets_stub.dart
View file @
bd20550
import
'./socket_notifier.dart'
;
class
BaseWebSocket
{
String
?
url
;
String
url
;
Duration
ping
;
bool
allowSelfSigned
;
BaseWebSocket
(
...
...
lib/get_instance/src/extension_instance.dart
View file @
bd20550
...
...
@@ -109,7 +109,8 @@ extension Inst on GetInterface {
/// Checks if a Class Instance<[S]> (or [tag]) is registered in memory.
/// - [tag] optional, if you use a [tag] to register the Instance.
bool
isRegistered
<
S
>({
String
?
tag
})
=>
GetInstance
().
isRegistered
<
S
>(
tag:
tag
);
bool
isRegistered
<
S
>({
String
?
tag
})
=>
GetInstance
().
isRegistered
<
S
>(
tag:
tag
);
/// Checks if an Instance<[S]> (or [tag]) returned from a factory builder
/// [Get.lazyPut()], is registered in memory.
...
...
lib/get_instance/src/get_instance.dart
View file @
bd20550
import
'dart:async'
;
import
'dart:collection'
;
import
'package:flutter/foundation.dart'
;
import
'../../get_core/get_core.dart'
;
import
'lifecycle.dart'
;
...
...
@@ -177,7 +175,6 @@ class GetInstance {
required
InstanceBuilderCallback
<
S
>
builder
,
bool
fenix
=
false
,
})
{
assert
(
builder
!=
null
);
final
key
=
_getKey
(
S
,
name
);
_singl
.
putIfAbsent
(
key
,
...
...
@@ -209,10 +206,8 @@ class GetInstance {
for
(
final
onClose
in
_routesByCreate
[
routeName
]!)
{
// assure the [DisposableInterface] instance holding a reference
// to [onClose()] wasn't disposed.
if
(
onClose
!=
null
)
{
onClose
();
}
}
_routesByCreate
[
routeName
]!.
clear
();
_routesByCreate
.
remove
(
routeName
);
}
...
...
@@ -222,7 +217,7 @@ class GetInstance {
}
for
(
final
element
in
keysToRemove
)
{
_routesKey
?
.
remove
(
element
);
_routesKey
.
remove
(
element
);
}
keysToRemove
.
clear
();
}
...
...
@@ -286,15 +281,13 @@ class GetInstance {
final
key
=
_getKey
(
S
,
tag
);
final
i
=
_singl
[
key
]!.
getDependency
()
as
S
?;
if
(
i
is
GetLifeCycleBase
)
{
if
(
i
.
onStart
!=
null
)
{
i
.
onStart
();
if
(
tag
==
null
)
{
Get
.
log
(
'Instance "
$S
" has been initialized'
);
}
else
{
Get
.
log
(
'Instance "
$S
" with tag "
$tag
" has been initialized'
);
}
}
if
(!
_singl
[
key
]!.
isSingleton
!
&&
i
.
onDelete
!=
null
)
{
if
(!
_singl
[
key
]!.
isSingleton
!)
{
_routesByCreate
[
Get
.
reference
]
??=
HashSet
<
Function
>();
_routesByCreate
[
Get
.
reference
]!.
add
(
i
.
onDelete
as
Function
);
}
...
...
@@ -398,7 +391,7 @@ class GetInstance {
return
false
;
}
if
(
i
is
GetLifeCycleBase
&&
i
.
onDelete
!=
null
)
{
if
(
i
is
GetLifeCycleBase
)
{
i
.
onDelete
();
Get
.
log
(
'"
$newKey
" onDelete() called'
);
}
...
...
lib/get_navigation/src/bottomsheet/bottomsheet.dart
View file @
bd20550
...
...
@@ -18,10 +18,7 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
RouteSettings
?
settings
,
this
.
enterBottomSheetDuration
=
const
Duration
(
milliseconds:
250
),
this
.
exitBottomSheetDuration
=
const
Duration
(
milliseconds:
200
),
})
:
assert
(
isScrollControlled
!=
null
),
name
=
"BOTTOMSHEET:
${builder.hashCode}
"
,
assert
(
isDismissible
!=
null
),
assert
(
enableDrag
!=
null
),
})
:
name
=
"BOTTOMSHEET:
${builder.hashCode}
"
,
super
(
settings:
settings
);
final
bool
?
isPersistent
;
final
WidgetBuilder
?
builder
;
...
...
@@ -80,10 +77,10 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
child:
_GetModalBottomSheet
<
T
>(
route:
this
,
backgroundColor:
backgroundColor
??
sheetTheme
?.
modalBackgroundColor
??
sheetTheme
?.
backgroundColor
,
sheetTheme
.
modalBackgroundColor
??
sheetTheme
.
backgroundColor
,
elevation:
elevation
??
sheetTheme
?.
modalElevation
??
sheetTheme
?
.
elevation
,
elevation
??
sheetTheme
.
modalElevation
??
sheetTheme
.
elevation
,
shape:
shape
,
clipBehavior:
clipBehavior
,
isScrollControlled:
isScrollControlled
,
...
...
@@ -107,9 +104,7 @@ class _GetModalBottomSheet<T> extends StatefulWidget {
this
.
isScrollControlled
=
false
,
this
.
enableDrag
=
true
,
this
.
isPersistent
=
false
,
})
:
assert
(
isScrollControlled
!=
null
),
assert
(
enableDrag
!=
null
),
super
(
key:
key
);
})
:
super
(
key:
key
);
final
bool
isPersistent
;
final
GetModalBottomSheetRoute
<
T
>?
route
;
final
bool
isScrollControlled
;
...
...
@@ -208,9 +203,7 @@ class _GetPerModalBottomSheet<T> extends StatefulWidget {
this
.
clipBehavior
,
this
.
isScrollControlled
=
false
,
this
.
enableDrag
=
true
,
})
:
assert
(
isScrollControlled
!=
null
),
assert
(
enableDrag
!=
null
),
super
(
key:
key
);
})
:
super
(
key:
key
);
final
bool
?
isPersistent
;
final
GetModalBottomSheetRoute
<
T
>?
route
;
final
bool
isScrollControlled
;
...
...
lib/get_navigation/src/dialog/dialog_route.dart
View file @
bd20550
...
...
@@ -11,8 +11,7 @@ class GetDialogRoute<T> extends PopupRoute<T> {
Duration
transitionDuration
=
const
Duration
(
milliseconds:
200
),
RouteTransitionsBuilder
?
transitionBuilder
,
RouteSettings
?
settings
,
})
:
assert
(
barrierDismissible
!=
null
),
widget
=
pageBuilder
,
})
:
widget
=
pageBuilder
,
name
=
"DIALOG:
${pageBuilder.hashCode}
"
,
_barrierDismissible
=
barrierDismissible
,
_barrierLabel
=
barrierLabel
,
...
...
lib/get_navigation/src/extension_navigation.dart
View file @
bd20550
...
...
@@ -145,9 +145,7 @@ extension ExtensionSnackbar on GetInterface {
})
async
{
final
getBar
=
GetBar
(
snackbarStatus:
snackbarStatus
,
titleText:
(
title
==
null
)
?
null
:
titleText
??
titleText:
titleText
??
Text
(
title
,
style:
TextStyle
(
...
...
@@ -224,10 +222,6 @@ extension ExtensionDialog on GetInterface {
String
?
name
,
RouteSettings
?
routeSettings
,
})
{
assert
(
widget
!=
null
);
assert
(
barrierDismissible
!=
null
);
assert
(
useSafeArea
!=
null
);
assert
(
useRootNavigator
!=
null
);
assert
(
debugCheckHasMaterialLocalizations
(
context
!));
// final theme = Theme.of(context, shadowThemeOnly: true);
...
...
@@ -236,9 +230,7 @@ extension ExtensionDialog on GetInterface {
pageBuilder:
(
buildContext
,
animation
,
secondaryAnimation
)
{
final
pageChild
=
widget
;
Widget
dialog
=
Builder
(
builder:
(
context
)
{
return
theme
!=
null
?
Theme
(
data:
theme
,
child:
pageChild
)
:
pageChild
;
return
Theme
(
data:
theme
,
child:
pageChild
);
});
if
(
useSafeArea
)
{
dialog
=
SafeArea
(
child:
dialog
);
...
...
@@ -275,8 +267,6 @@ extension ExtensionDialog on GetInterface {
bool
useRootNavigator
=
true
,
RouteSettings
?
routeSettings
,
})
{
assert
(
pageBuilder
!=
null
);
assert
(
useRootNavigator
!=
null
);
assert
(!
barrierDismissible
||
barrierLabel
!=
null
);
return
Navigator
.
of
(
overlayContext
!,
rootNavigator:
useRootNavigator
)
.
push
<
T
>(
GetDialogRoute
<
T
>(
...
...
@@ -383,7 +373,7 @@ extension ExtensionDialog on GetInterface {
mainAxisSize:
MainAxisSize
.
min
,
children:
[
content
??
Text
(
middleText
??
""
,
Text
(
middleText
,
textAlign:
TextAlign
.
center
,
style:
middleTextStyle
),
SizedBox
(
height:
16
),
ButtonTheme
(
...
...
@@ -437,13 +427,6 @@ extension ExtensionBottomSheet on GetInterface {
Duration
?
enterBottomSheetDuration
,
Duration
?
exitBottomSheetDuration
,
})
{
assert
(
bottomsheet
!=
null
);
assert
(
persistent
!=
null
);
assert
(
isScrollControlled
!=
null
);
assert
(
useRootNavigator
!=
null
);
assert
(
isDismissible
!=
null
);
assert
(
enableDrag
!=
null
);
return
Navigator
.
of
(
overlayContext
!,
rootNavigator:
useRootNavigator
)
.
push
(
GetModalBottomSheetRoute
<
T
>(
builder:
(
_
)
=>
bottomsheet
,
...
...
@@ -822,7 +805,7 @@ you can only use widgets and widget functions here''';
/// [id] is for when you are using nested navigation,
/// as explained in documentation
void
close
(
int
times
,
[
int
?
id
])
{
if
(
(
times
==
null
)
||
(
times
<
1
)
)
{
if
(
times
<
1
)
{
times
=
1
;
}
var
count
=
0
;
...
...
@@ -874,7 +857,7 @@ you can only use widgets and widget functions here''';
return
null
;
}
return
global
(
id
)?.
currentState
?.
pushReplacement
(
GetPageRoute
(
opaque:
opaque
??
true
,
opaque:
opaque
,
page:
_resolve
(
page
,
'off'
),
binding:
binding
,
settings:
RouteSettings
(
arguments:
arguments
),
...
...
@@ -934,7 +917,7 @@ you can only use widgets and widget functions here''';
return
global
(
id
)?.
currentState
?.
pushAndRemoveUntil
<
T
>(
GetPageRoute
<
T
>(
opaque:
opaque
??
true
,
opaque:
opaque
,
popGesture:
popGesture
??
defaultPopGesture
,
page:
_resolve
(
page
,
'offAll'
),
binding:
binding
,
...
...
@@ -950,19 +933,15 @@ you can only use widgets and widget functions here''';
void
addPages
(
List
<
GetPage
>?
getPages
)
{
if
(
getPages
!=
null
)
{
if
(
routeTree
==
null
)
{
routeTree
=
ParseRouteTree
();
}
routeTree
!
.
addRoutes
(
getPages
);
routeTree
.
addRoutes
(
getPages
);
}
}
void
addPage
(
GetPage
getPage
)
{
if
(
getPage
!=
null
)
{
if
(
routeTree
==
null
)
routeTree
=
ParseRouteTree
();
routeTree
!.
addRoute
(
getPage
);
}
routeTree
=
ParseRouteTree
();
routeTree
.
addRoute
(
getPage
);
}
/// change default config of Get
...
...
@@ -1100,7 +1079,7 @@ Since version 2.8 it is possible to access the properties
/// give access to current Overlay Context
BuildContext
?
get
overlayContext
{
BuildContext
?
overlay
;
key
?.
currentState
?.
overlay
?.
context
?
.
visitChildElements
((
element
)
{
key
?.
currentState
?.
overlay
?.
context
.
visitChildElements
((
element
)
{
overlay
=
element
;
});
return
overlay
;
...
...
@@ -1166,7 +1145,7 @@ Since version 2.8 it is possible to access the properties
(
ui
.
window
.
platformBrightness
==
Brightness
.
dark
);
/// give access to Theme.of(context).iconTheme.color
Color
?
get
iconColor
=>
theme
?.
iconTheme
?
.
color
;
Color
?
get
iconColor
=>
theme
?.
iconTheme
.
color
;
/// give access to FocusScope.of(context)
FocusNode
?
get
focusScope
=>
FocusManager
.
instance
.
primaryFocus
;
...
...
@@ -1204,8 +1183,8 @@ Since version 2.8 it is possible to access the properties
Routing
get
routing
=>
getxController
.
routing
;
Map
<
String
?,
String
>
get
parameters
=>
getxController
.
parameters
;
set
parameters
(
Map
<
String
?,
String
>
newParameters
)
=>
Map
<
String
,
String
?>
get
parameters
=>
getxController
.
parameters
;
set
parameters
(
Map
<
String
,
String
?>
newParameters
)
=>
getxController
.
parameters
=
newParameters
;
ParseRouteTree
get
routeTree
=>
getxController
.
routeTree
;
...
...
lib/get_navigation/src/routes/default_route.dart
View file @
bd20550
...
...
@@ -31,11 +31,7 @@ class GetPageRoute<T> extends PageRoute<T> {
this
.
maintainState
=
true
,
bool
fullscreenDialog
=
false
,
this
.
middlewares
,
})
:
assert
(
opaque
!=
null
),
assert
(
barrierDismissible
!=
null
),
assert
(
maintainState
!=
null
),
assert
(
fullscreenDialog
!=
null
),
reference
=
"
$routeName
:
${page.hashCode}
"
,
})
:
reference
=
"
$routeName
:
${page.hashCode}
"
,
super
(
settings:
settings
,
fullscreenDialog:
fullscreenDialog
);
@override
...
...
@@ -416,10 +412,7 @@ class _CupertinoBackGestureDetector<T> extends StatefulWidget {
required
this
.
enabledCallback
,
required
this
.
onStartPopGesture
,
required
this
.
child
,
})
:
assert
(
enabledCallback
!=
null
),
assert
(
onStartPopGesture
!=
null
),
assert
(
child
!=
null
),
super
(
key:
key
);
})
:
super
(
key:
key
);
final
Widget
child
;
...
...
@@ -533,8 +526,7 @@ class _CupertinoBackGestureController<T> {
_CupertinoBackGestureController
({
required
this
.
navigator
,
required
this
.
controller
,
})
:
assert
(
navigator
!=
null
),
assert
(
controller
!=
null
)
{
})
{
navigator
.
didStartUserGesture
();
}
...
...
lib/get_navigation/src/routes/get_route.dart
View file @
bd20550
...
...
@@ -51,11 +51,7 @@ class GetPage {
this
.
fullscreenDialog
=
false
,
this
.
children
,
this
.
middlewares
,
})
:
path
=
_nameToRegex
(
name
),
assert
(
page
!=
null
),
assert
(
name
!=
null
),
assert
(
maintainState
!=
null
),
assert
(
fullscreenDialog
!=
null
);
})
:
path
=
_nameToRegex
(
name
);
static
PathDecoded
_nameToRegex
(
String
path
)
{
var
keys
=
<
String
?>[];
...
...
lib/get_navigation/src/routes/observers/route_observer.dart
View file @
bd20550
...
...
@@ -36,7 +36,7 @@ class Routing {
/// Extracts the name of a route based on it's instance type
/// or null if not possible.
String
?
_extractRouteName
(
Route
?
route
)
{
if
(
route
?.
settings
?
.
name
!=
null
)
{
if
(
route
?.
settings
.
name
!=
null
)
{
return
route
!.
settings
.
name
;
}
...
...
@@ -110,7 +110,7 @@ class GetObserver extends NavigatorObserver {
value
.
current
=
newRoute
.
name
??
''
;
}
value
.
args
=
route
?.
settings
?
.
arguments
;
value
.
args
=
route
.
settings
.
arguments
;
value
.
route
=
route
;
value
.
isBack
=
false
;
value
.
removed
=
''
;
...
...
@@ -151,7 +151,7 @@ class GetObserver extends NavigatorObserver {
value
.
current
=
_extractRouteName
(
previousRoute
)
??
''
;
}
value
.
args
=
route
?.
settings
?
.
arguments
;
value
.
args
=
route
.
settings
.
arguments
;
value
.
route
=
previousRoute
;
value
.
isBack
=
true
;
value
.
removed
=
''
;
...
...
@@ -183,7 +183,7 @@ class GetObserver extends NavigatorObserver {
value
.
current
=
newName
??
''
;
}
value
.
args
=
newRoute
?.
settings
?
.
arguments
;
value
.
args
=
newRoute
?.
settings
.
arguments
;
value
.
route
=
newRoute
;
value
.
isBack
=
false
;
value
.
removed
=
''
;
...
...
lib/get_navigation/src/routes/route_middleware.dart
View file @
bd20550
...
...
@@ -113,7 +113,7 @@ class MiddlewareRunner {
}
GetPage
?
runOnPageCalled
(
GetPage
?
page
)
{
_getMiddlewares
()
!
.
forEach
((
element
)
{
_getMiddlewares
()
?
.
forEach
((
element
)
{
page
=
element
.
onPageCalled
(
page
);
});
return
page
;
...
...
@@ -121,7 +121,7 @@ class MiddlewareRunner {
RouteSettings
?
runRedirect
(
String
?
route
)
{
RouteSettings
?
to
;
_getMiddlewares
()
!
.
forEach
((
element
)
{
_getMiddlewares
()
?
.
forEach
((
element
)
{
to
=
element
.
redirect
(
route
);
});
if
(
to
!=
null
)
{
...
...
@@ -131,28 +131,28 @@ class MiddlewareRunner {
}
List
<
Bindings
>?
runOnBindingsStart
(
List
<
Bindings
>?
bindings
)
{
_getMiddlewares
()
!
.
forEach
((
element
)
{
_getMiddlewares
()
?
.
forEach
((
element
)
{
bindings
=
element
.
onBindingsStart
(
bindings
);
});
return
bindings
;
}
GetPageBuilder
?
runOnPageBuildStart
(
GetPageBuilder
?
page
)
{
_getMiddlewares
()
!
.
forEach
((
element
)
{
_getMiddlewares
()
?
.
forEach
((
element
)
{
page
=
element
.
onPageBuildStart
(
page
);
});
return
page
;
}
Widget
runOnPageBuilt
(
Widget
page
)
{
_getMiddlewares
()
!
.
forEach
((
element
)
{
_getMiddlewares
()
?
.
forEach
((
element
)
{
page
=
element
.
onPageBuilt
(
page
);
});
return
page
;
}
void
runOnPageDispose
()
=>
_getMiddlewares
()
!
.
forEach
((
element
)
=>
element
.
onPageDispose
());
_getMiddlewares
()
?
.
forEach
((
element
)
=>
element
.
onPageDispose
());
}
class
PageRedirect
{
...
...
@@ -205,11 +205,11 @@ class PageRedirect {
/// check if redirect is needed
bool
needRecheck
()
{
final
match
=
Get
.
routeTree
!.
matchRoute
(
settings
.
name
!);
Get
.
parameters
=
match
?.
parameters
;
final
match
=
Get
.
routeTree
.
matchRoute
(
settings
.
name
!);
Get
.
parameters
=
match
.
parameters
;
// No Match found
if
(
match
?
.
route
==
null
)
{
if
(
match
.
route
==
null
)
{
isUnknown
=
true
;
return
false
;
}
...
...
@@ -233,12 +233,8 @@ class PageRedirect {
void
addPageParameter
(
GetPage
route
)
{
if
(
route
.
parameter
==
null
)
return
;
if
(
Get
.
parameters
==
null
)
{
Get
.
parameters
=
route
.
parameter
!;
}
else
{
final
parameters
=
Get
.
parameters
;
parameters
.
addEntries
(
route
.
parameter
!.
entries
);
Get
.
parameters
=
parameters
;
}
}
}
...
...
lib/get_navigation/src/snackbar/snack.dart
View file @
bd20550
...
...
@@ -603,8 +603,7 @@ Set either a message or messageText""");
Padding
(
padding:
EdgeInsets
.
only
(
right:
buttonRightPadding
),
child:
_getMainActionButton
(),
)
??
_emptyWidget
,
),
];
}
}
...
...
lib/get_navigation/src/snackbar/snack_route.dart
View file @
bd20550
...
...
@@ -176,8 +176,7 @@ class SnackRoute<T> extends OverlayRoute<T> {
AnimationController
createAnimationController
()
{
assert
(!
_transitionCompleter
.
isCompleted
,
'Cannot reuse a
$runtimeType
after disposing it.'
);
assert
(
snack
.
animationDuration
!=
null
&&
snack
.
animationDuration
>=
Duration
.
zero
);
assert
(
snack
.
animationDuration
>=
Duration
.
zero
);
return
AnimationController
(
duration:
snack
.
animationDuration
,
debugLabel:
debugLabel
,
...
...
lib/get_rx/src/rx_stream/mini_stream.dart
View file @
bd20550
...
...
@@ -14,59 +14,61 @@ class MiniSubscription<T> {
final
Callback
?
onDone
;
final
bool
cancelOnError
;
Future
<
void
>
cancel
()
async
=>
listener
!
.
removeListener
(
this
);
Future
<
void
>
cancel
()
async
=>
listener
.
removeListener
(
this
);
final
FastList
<
T
>
?
listener
;
final
FastList
<
T
>
listener
;
}
class
MiniStream
<
T
>
{
FastList
<
T
?>?
listenable
=
FastList
<
T
>();
FastList
<
T
>
listenable
=
FastList
<
T
>();
T
?
_value
;
late
T
_value
;
T
?
get
value
=>
_value
;
T
get
value
=>
_value
;
set
value
(
T
?
val
)
{
set
value
(
T
val
)
{
add
(
val
);
}
void
add
(
T
?
event
)
{
assert
(
listenable
!=
null
);
void
add
(
T
event
)
{
_value
=
event
;
listenable
!
.
_notifyData
(
event
);
listenable
.
_notifyData
(
event
);
}
void
addError
(
Object
error
,
[
StackTrace
?
stackTrace
])
{
assert
(
listenable
!=
null
);
listenable
!.
_notifyError
(
error
,
stackTrace
);
listenable
.
_notifyError
(
error
,
stackTrace
);
}
int
get
length
=>
listenable
!
.
length
;
int
get
length
=>
listenable
.
length
;
bool
get
hasListeners
=>
listenable
!
.
isNotEmpty
;
bool
get
hasListeners
=>
listenable
.
isNotEmpty
;
bool
get
isClosed
=>
listenable
==
null
;
bool
get
isClosed
=>
_isClosed
;
MiniSubscription
<
T
?>
listen
(
void
Function
(
T
?
event
)
onData
,
{
Function
?
onError
,
void
Function
()?
onDone
,
bool
cancelOnError
=
false
})
{
final
subs
=
MiniSubscription
<
T
?>(
MiniSubscription
<
T
>
listen
(
void
Function
(
T
event
)
onData
,
{
Function
?
onError
,
void
Function
()?
onDone
,
bool
cancelOnError
=
false
})
{
final
subs
=
MiniSubscription
<
T
>(
onData
,
onError
,
onDone
,
cancelOnError
,
listenable
,
);
listenable
!
.
addListener
(
subs
);
listenable
.
addListener
(
subs
);
return
subs
;
}
bool
_isClosed
=
false
;
void
close
()
{
if
(
listenable
==
null
)
{
if
(
_isClosed
)
{
throw
'You can not close a closed Stream'
;
}
listenable
!.
_notifyDone
();
listenable
=
null
;
_value
=
null
;
listenable
.
_notifyDone
();
listenable
.
clear
();
_isClosed
=
true
;
}
}
...
...
@@ -74,18 +76,18 @@ class FastList<T> {
Node
<
MiniSubscription
<
T
>>?
_head
;
void
_notifyData
(
T
data
)
{
var
currentNode
=
_head
!
;
var
currentNode
=
_head
;
do
{
currentNode
.
data
!.
data
(
data
);
currentNode
=
currentNode
.
next
!;
currentNode
?.
data
?.
data
(
data
);
currentNode
=
currentNode
?.
next
;
}
while
(
currentNode
!=
null
);
}
void
_notifyDone
()
{
var
currentNode
=
_head
!
;
var
currentNode
=
_head
;
do
{
currentNode
.
data
!.
onDone
?.
call
();
currentNode
=
currentNode
.
next
!;
currentNode
?.
data
?.
onDone
?.
call
();
currentNode
=
currentNode
?.
next
;
}
while
(
currentNode
!=
null
);
}
...
...
@@ -164,6 +166,13 @@ class FastList<T> {
}
}
void
clear
()
{
var
length
=
this
.
length
;
for
(
var
i
=
0
;
i
<
length
;
i
++)
{
_removeAt
(
i
);
}
}
MiniSubscription
<
T
>?
_removeAt
(
int
position
)
{
var
index
=
0
;
var
currentNode
=
_head
;
...
...
lib/get_rx/src/rx_stream/rx_stream.dart
View file @
bd20550
library
rx_stream
;
import
'dart:async'
;
import
'../rx_typedefs/rx_typedefs.dart'
;
part
'get_stream.dart'
;
...
...
lib/get_rx/src/rx_types/rx_core/rx_num.dart
View file @
bd20550
...
...
@@ -408,18 +408,18 @@ class RxDouble extends _BaseRxNum<double?> {
double
truncateToDouble
()
=>
value
!.
truncateToDouble
();
}
class
RxInt
extends
_BaseRxNum
<
int
?>
{
RxInt
([
int
?
initial
])
:
super
(
initial
);
class
RxInt
extends
_BaseRxNum
<
int
>
{
RxInt
(
int
initial
)
:
super
(
initial
);
/// Addition operator.
RxInt
operator
+(
int
other
)
{
value
=
value
!
+
other
;
value
=
value
+
other
;
return
this
;
}
/// Subtraction operator.
RxInt
operator
-(
int
other
)
{
value
=
value
!
-
other
;
value
=
value
-
other
;
return
this
;
}
...
...
@@ -431,7 +431,7 @@ class RxInt extends _BaseRxNum<int?> {
///
/// If both operands are negative, the result is negative, otherwise
/// the result is non-negative.
int
operator
&(
int
other
)
=>
value
!
&
other
;
int
operator
&(
int
other
)
=>
value
&
other
;
/// Bit-wise or operator.
///
...
...
@@ -441,7 +441,7 @@ class RxInt extends _BaseRxNum<int?> {
///
/// If both operands are non-negative, the result is non-negative,
/// otherwise the result is negative.
int
operator
|(
int
other
)
=>
value
!
|
other
;
int
operator
|(
int
other
)
=>
value
|
other
;
/// Bit-wise exclusive-or operator.
///
...
...
@@ -451,7 +451,7 @@ class RxInt extends _BaseRxNum<int?> {
///
/// If the operands have the same sign, the result is non-negative,
/// otherwise the result is negative.
int
operator
^(
int
other
)
=>
value
!
^
other
;
int
operator
^(
int
other
)
=>
value
^
other
;
/// The bit-wise negate operator.
///
...
...
@@ -459,7 +459,7 @@ class RxInt extends _BaseRxNum<int?> {
/// the result is a number with the opposite bits set.
///
/// This maps any integer `x` to `-x - 1`.
int
operator
~()
=>
~
value
!
;
int
operator
~()
=>
~
value
;
/// Shift the bits of this integer to the left by [shiftAmount].
///
...
...
@@ -471,7 +471,7 @@ class RxInt extends _BaseRxNum<int?> {
/// mask.
///
/// It is an error if [shiftAmount] is negative.
int
operator
<<(
int
shiftAmount
)
=>
value
!
<<
shiftAmount
;
int
operator
<<(
int
shiftAmount
)
=>
value
<<
shiftAmount
;
/// Shift the bits of this integer to the right by [shiftAmount].
///
...
...
@@ -480,13 +480,13 @@ class RxInt extends _BaseRxNum<int?> {
///`pow(2, shiftIndex)`.
///
/// It is an error if [shiftAmount] is negative.
int
operator
>>(
int
shiftAmount
)
=>
value
!
>>
shiftAmount
;
int
operator
>>(
int
shiftAmount
)
=>
value
>>
shiftAmount
;
/// Returns this integer to the power of [exponent] modulo [modulus].
///
/// The [exponent] must be non-negative and [modulus] must be
/// positive.
int
modPow
(
int
exponent
,
int
modulus
)
=>
value
!
.
modPow
(
exponent
,
modulus
);
int
modPow
(
int
exponent
,
int
modulus
)
=>
value
.
modPow
(
exponent
,
modulus
);
/// Returns the modular multiplicative inverse of this integer
/// modulo [modulus].
...
...
@@ -494,7 +494,7 @@ class RxInt extends _BaseRxNum<int?> {
/// The [modulus] must be positive.
///
/// It is an error if no modular inverse exists.
int
modInverse
(
int
modulus
)
=>
value
!
.
modInverse
(
modulus
);
int
modInverse
(
int
modulus
)
=>
value
.
modInverse
(
modulus
);
/// Returns the greatest common divisor of this integer and [other].
///
...
...
@@ -507,13 +507,13 @@ class RxInt extends _BaseRxNum<int?> {
/// For any integer `x`, `x.gcd(x)` is `x.abs()`.
///
/// If both `this` and `other` is zero, the result is also zero.
int
gcd
(
int
other
)
=>
value
!
.
gcd
(
other
);
int
gcd
(
int
other
)
=>
value
.
gcd
(
other
);
/// Returns true if and only if this integer is even.
bool
get
isEven
=>
value
!
.
isEven
;
bool
get
isEven
=>
value
.
isEven
;
/// Returns true if and only if this integer is odd.
bool
get
isOdd
=>
value
!
.
isOdd
;
bool
get
isOdd
=>
value
.
isOdd
;
/// Returns the minimum number of bits required to store this integer.
///
...
...
@@ -535,7 +535,7 @@ class RxInt extends _BaseRxNum<int?> {
/// (-3).bitLength == 2; // 11111101
/// (-4).bitLength == 2; // 11111100
/// ```
int
get
bitLength
=>
value
!
.
bitLength
;
int
get
bitLength
=>
value
.
bitLength
;
/// Returns the least significant [width] bits of this integer as a
/// non-negative number (i.e. unsigned representation). The returned value
...
...
@@ -557,7 +557,7 @@ class RxInt extends _BaseRxNum<int?> {
/// ```
/// x == x.toUnsigned(x.bitLength);
/// ```
int
toUnsigned
(
int
width
)
=>
value
!
.
toUnsigned
(
width
);
int
toUnsigned
(
int
width
)
=>
value
.
toUnsigned
(
width
);
/// Returns the least significant [width] bits of this integer, extending the
/// highest retained bit to the sign. This is the same as truncating the
...
...
@@ -587,57 +587,57 @@ class RxInt extends _BaseRxNum<int?> {
/// ```
/// x == x.toSigned(x.bitLength + 1);
/// ```
int
toSigned
(
int
width
)
=>
value
!
.
toSigned
(
width
);
int
toSigned
(
int
width
)
=>
value
.
toSigned
(
width
);
/// Return the negative value of this integer.
///
/// The result of negating an integer always has the opposite sign, except
/// for zero, which is its own negation.
@override
int
operator
-()
=>
-
value
!
;
int
operator
-()
=>
-
value
;
/// Returns the absolute value of this integer.
///
/// For any integer `x`, the result is the same as `x < 0 ? -x : x`.
@override
int
abs
()
=>
value
!
.
abs
();
int
abs
()
=>
value
.
abs
();
/// Returns the sign of this integer.
///
/// Returns 0 for zero, -1 for values less than zero and
/// +1 for values greater than zero.
@override
int
get
sign
=>
value
!
.
sign
;
int
get
sign
=>
value
.
sign
;
/// Returns `this`.
@override
int
round
()
=>
value
!
.
round
();
int
round
()
=>
value
.
round
();
/// Returns `this`.
@override
int
floor
()
=>
value
!
.
floor
();
int
floor
()
=>
value
.
floor
();
/// Returns `this`.
@override
int
ceil
()
=>
value
!
.
ceil
();
int
ceil
()
=>
value
.
ceil
();
/// Returns `this`.
@override
int
truncate
()
=>
value
!
.
truncate
();
int
truncate
()
=>
value
.
truncate
();
/// Returns `this.toDouble()`.
@override
double
roundToDouble
()
=>
value
!
.
roundToDouble
();
double
roundToDouble
()
=>
value
.
roundToDouble
();
/// Returns `this.toDouble()`.
@override
double
floorToDouble
()
=>
value
!
.
floorToDouble
();
double
floorToDouble
()
=>
value
.
floorToDouble
();
/// Returns `this.toDouble()`.
@override
double
ceilToDouble
()
=>
value
!
.
ceilToDouble
();
double
ceilToDouble
()
=>
value
.
ceilToDouble
();
/// Returns `this.toDouble()`.
@override
double
truncateToDouble
()
=>
value
!
.
truncateToDouble
();
double
truncateToDouble
()
=>
value
.
truncateToDouble
();
}
...
...
lib/get_rx/src/rx_types/rx_iterables/rx_list.dart
View file @
bd20550
...
...
@@ -5,10 +5,8 @@ class RxList<E> extends ListMixin<E>
with
NotifyManager
<
List
<
E
>>,
RxObjectMixin
<
List
<
E
>>
implements
RxInterface
<
List
<
E
>>
{
RxList
([
List
<
E
>
initial
=
const
[]])
{
if
(
initial
!=
null
)
{
_value
=
List
.
from
(
initial
);
}
}
factory
RxList
.
filled
(
int
length
,
E
fill
,
{
bool
growable
=
false
})
{
return
RxList
(
List
.
filled
(
length
,
fill
,
growable:
growable
));
...
...
@@ -40,11 +38,11 @@ class RxList<E> extends ListMixin<E>
}
@override
Iterator
<
E
>
get
iterator
=>
value
!
.
iterator
;
Iterator
<
E
>
get
iterator
=>
value
.
iterator
;
@override
void
operator
[]=(
int
index
,
E
val
)
{
_value
!
[
index
]
=
val
;
_value
[
index
]
=
val
;
refresh
();
}
...
...
@@ -59,18 +57,18 @@ class RxList<E> extends ListMixin<E>
@override
E
operator
[](
int
index
)
{
return
value
!
[
index
];
return
value
[
index
];
}
@override
void
add
(
E
item
)
{
_value
!
.
add
(
item
);
_value
.
add
(
item
);
refresh
();
}
@override
void
addAll
(
Iterable
<
E
>
item
)
{
_value
!
.
addAll
(
item
);
_value
.
addAll
(
item
);
refresh
();
}
...
...
@@ -103,17 +101,17 @@ class RxList<E> extends ListMixin<E>
@override
Iterable
<
E
>
where
(
bool
Function
(
E
)
test
)
{
return
value
!
.
where
(
test
);
return
value
.
where
(
test
);
}
@override
Iterable
<
T
>
whereType
<
T
>()
{
return
value
!
.
whereType
<
T
>();
return
value
.
whereType
<
T
>();
}
@override
void
sort
([
int
compare
(
E
a
,
E
b
)?])
{
_value
!
.
sort
(
compare
);
_value
.
sort
(
compare
);
refresh
();
}
}
...
...
@@ -126,10 +124,10 @@ extension ListExtension<E> on List<E> {
if
(
item
!=
null
)
add
(
item
);
}
/// Add [Iterable<E>] to [List<E>] only if [Iterable<E>] is not null.
void
addAllNonNull
(
Iterable
<
E
>
item
)
{
if
(
item
!=
null
)
addAll
(
item
);
}
// /// Add [Iterable<E>] to [List<E>] only if [Iterable<E>] is not null.
// void addAllNonNull(Iterable<E> item) {
// if (item != null) addAll(item);
// }
/// Add [item] to [List<E>] only if [condition] is true.
void
addIf
(
dynamic
condition
,
E
item
)
{
...
...
@@ -146,7 +144,7 @@ extension ListExtension<E> on List<E> {
/// Replaces all existing items of this list with [item]
void
assign
(
E
item
)
{
if
(
this
is
RxList
)
{
(
this
as
RxList
).
_value
??=
<
E
>[]
;
(
this
as
RxList
).
_value
;
}
clear
();
...
...
@@ -156,7 +154,7 @@ extension ListExtension<E> on List<E> {
/// Replaces all existing items of this list with [items]
void
assignAll
(
Iterable
<
E
>
items
)
{
if
(
this
is
RxList
)
{
(
this
as
RxList
).
_value
??=
<
E
>[]
;
(
this
as
RxList
).
_value
;
}
clear
();
addAll
(
items
);
...
...
lib/get_rx/src/rx_types/rx_iterables/rx_map.dart
View file @
bd20550
...
...
@@ -4,10 +4,8 @@ class RxMap<K, V> extends MapMixin<K, V>
with
NotifyManager
<
Map
<
K
,
V
>>,
RxObjectMixin
<
Map
<
K
,
V
>>
implements
RxInterface
<
Map
<
K
,
V
>>
{
RxMap
([
Map
<
K
,
V
>
initial
=
const
{}])
{
if
(
initial
!=
null
)
{
_value
=
Map
.
from
(
initial
);
}
}
factory
RxMap
.
from
(
Map
<
K
,
V
>
other
)
{
return
RxMap
(
Map
.
from
(
other
));
...
...
@@ -30,27 +28,27 @@ class RxMap<K, V> extends MapMixin<K, V>
@override
V
?
operator
[](
Object
?
key
)
{
return
value
!
[
key
as
K
];
return
value
[
key
as
K
];
}
@override
void
operator
[]=(
K
key
,
V
value
)
{
_value
!
[
key
]
=
value
;
_value
[
key
]
=
value
;
refresh
();
}
@override
void
clear
()
{
_value
!
.
clear
();
_value
.
clear
();
refresh
();
}
@override
Iterable
<
K
>
get
keys
=>
value
!
.
keys
;
Iterable
<
K
>
get
keys
=>
value
.
keys
;
@override
V
?
remove
(
Object
?
key
)
{
final
val
=
_value
!
.
remove
(
key
);
final
val
=
_value
.
remove
(
key
);
refresh
();
return
val
;
}
...
...
@@ -85,8 +83,8 @@ extension MapExtension<K, V> on Map<K, V> {
void
assign
(
K
key
,
V
val
)
{
if
(
this
is
RxMap
)
{
final
map
=
(
this
as
RxMap
);
map
.
_value
??=
<
K
,
V
>{};
map
.
_value
!.
clear
();
map
.
_value
;
map
.
_value
.
clear
();
this
[
key
]
=
val
;
}
else
{
clear
();
...
...
lib/get_rx/src/rx_types/rx_iterables/rx_set.dart
View file @
bd20550
...
...
@@ -4,10 +4,8 @@ class RxSet<E> extends SetMixin<E>
with
NotifyManager
<
Set
<
E
>>,
RxObjectMixin
<
Set
<
E
>>
implements
RxInterface
<
Set
<
E
>>
{
RxSet
([
Set
<
E
>
initial
=
const
{}])
{
if
(
initial
!=
null
)
{
_value
=
Set
.
from
(
initial
);
}
}
/// Special override to push() element(s) in a reactive way
/// inside the List,
...
...
@@ -41,30 +39,30 @@ class RxSet<E> extends SetMixin<E>
@override
bool
add
(
E
value
)
{
final
val
=
_value
!
.
add
(
value
);
final
val
=
_value
.
add
(
value
);
refresh
();
return
val
;
}
@override
bool
contains
(
Object
?
element
)
{
return
value
!
.
contains
(
element
);
return
value
.
contains
(
element
);
}
@override
Iterator
<
E
>
get
iterator
=>
value
!
.
iterator
;
Iterator
<
E
>
get
iterator
=>
value
.
iterator
;
@override
int
get
length
=>
value
!
.
length
;
int
get
length
=>
value
.
length
;
@override
E
?
lookup
(
Object
?
object
)
{
return
value
!
.
lookup
(
object
);
return
value
.
lookup
(
object
);
}
@override
bool
remove
(
Object
?
item
)
{
var
hasRemoved
=
_value
!
.
remove
(
item
);
var
hasRemoved
=
_value
.
remove
(
item
);
if
(
hasRemoved
)
{
refresh
();
}
...
...
@@ -73,36 +71,36 @@ class RxSet<E> extends SetMixin<E>
@override
Set
<
E
>
toSet
()
{
return
value
!
.
toSet
();
return
value
.
toSet
();
}
@override
void
addAll
(
Iterable
<
E
>
item
)
{
_value
!
.
addAll
(
item
);
_value
.
addAll
(
item
);
refresh
();
}
@override
void
clear
()
{
_value
!
.
clear
();
_value
.
clear
();
refresh
();
}
@override
void
removeAll
(
Iterable
<
Object
?>
elements
)
{
_value
!
.
removeAll
(
elements
);
_value
.
removeAll
(
elements
);
refresh
();
}
@override
void
retainAll
(
Iterable
<
Object
?>
elements
)
{
_value
!
.
retainAll
(
elements
);
_value
.
retainAll
(
elements
);
refresh
();
}
@override
void
retainWhere
(
bool
Function
(
E
)
E
)
{
_value
!
.
retainWhere
(
E
);
_value
.
retainWhere
(
E
);
refresh
();
}
}
...
...
@@ -137,7 +135,7 @@ extension SetExtension<E> on Set<E> {
/// Replaces all existing items of this list with [item]
void
assign
(
E
item
)
{
if
(
this
is
RxSet
)
{
(
this
as
RxSet
).
_value
??=
<
E
>{}
;
(
this
as
RxSet
).
_value
;
}
clear
();
...
...
@@ -147,7 +145,7 @@ extension SetExtension<E> on Set<E> {
/// Replaces all existing items of this list with [items]
void
assignAll
(
Iterable
<
E
>
items
)
{
if
(
this
is
RxSet
)
{
(
this
as
RxSet
).
_value
??=
<
E
>{}
;
(
this
as
RxSet
).
_value
;
}
clear
();
addAll
(
items
);
...
...
lib/get_rx/src/rx_workers/rx_workers.dart
View file @
bd20550
...
...
@@ -184,7 +184,6 @@ Worker interval<T>(
bool
?
cancelOnError
,
})
{
var
debounceActive
=
false
;
time
??=
const
Duration
(
seconds:
1
);
StreamSubscription
sub
=
listener
.
listen
(
(
event
)
async
{
if
(
debounceActive
||
!
_conditional
(
condition
))
return
;
...
...
lib/get_state_manager/src/rx_flutter/rx_getx_widget.dart
View file @
bd20550
...
...
@@ -67,7 +67,7 @@ class GetXState<T extends DisposableInterface> extends State<GetX<T>> {
}
else
{
controller
=
widget
.
init
;
isCreator
=
true
;
GetInstance
().
put
<
T
?>(
controller
,
tag:
widget
.
tag
);
GetInstance
().
put
<
T
>(
controller
!
,
tag:
widget
.
tag
);
}
}
else
{
controller
=
widget
.
init
;
...
...
lib/get_state_manager/src/rx_flutter/rx_notifier.dart
View file @
bd20550
...
...
@@ -138,7 +138,6 @@ extension StateExt<T> on StateMixin<T> {
Widget
?
onLoading
,
Widget
?
onEmpty
,
})
{
assert
(
widget
!=
null
);
return
SimpleBuilder
(
builder:
(
_
)
{
if
(
status
.
isLoading
)
{
return
onLoading
??
const
Center
(
child:
CircularProgressIndicator
());
...
...
lib/get_state_manager/src/simple/get_state.dart
View file @
bd20550
...
...
@@ -51,7 +51,7 @@ typedef GetControllerBuilder<T extends DisposableInterface> = Widget Function(
// }
// }
class
GetBuilder
<
T
extends
GetxController
?
>
extends
StatefulWidget
{
class
GetBuilder
<
T
extends
GetxController
>
extends
StatefulWidget
{
final
GetControllerBuilder
<
T
>
builder
;
final
bool
global
;
final
Object
?
id
;
...
...
@@ -77,8 +77,7 @@ class GetBuilder<T extends GetxController?> extends StatefulWidget {
this
.
id
,
this
.
didChangeDependencies
,
this
.
didUpdateWidget
,
})
:
assert
(
builder
!=
null
),
super
(
key:
key
);
})
:
super
(
key:
key
);
// static T of<T extends GetxController>(
// BuildContext context, {
...
...
@@ -103,7 +102,7 @@ class GetBuilder<T extends GetxController?> extends StatefulWidget {
_GetBuilderState
<
T
>
createState
()
=>
_GetBuilderState
<
T
>();
}
class
_GetBuilderState
<
T
extends
GetxController
?>
extends
State
<
GetBuilder
<
T
?
>>
class
_GetBuilderState
<
T
extends
GetxController
>
extends
State
<
GetBuilder
<
T
>>
with
GetStateUpdaterMixin
{
T
?
controller
;
bool
?
isCreator
=
false
;
...
...
@@ -136,7 +135,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
}
else
{
controller
=
widget
.
init
;
isCreator
=
true
;
GetInstance
().
put
<
T
?>(
controller
,
tag:
widget
.
tag
);
GetInstance
().
put
<
T
>(
controller
!
,
tag:
widget
.
tag
);
}
}
else
{
controller
=
widget
.
init
;
...
...
@@ -145,7 +144,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
}
if
(
widget
.
filter
!=
null
)
{
_filter
=
widget
.
filter
!(
controller
);
_filter
=
widget
.
filter
!(
controller
!
);
}
_subscribeToController
();
...
...
@@ -167,7 +166,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
}
void
_filterUpdate
()
{
var
newFilter
=
widget
.
filter
!(
controller
);
var
newFilter
=
widget
.
filter
!(
controller
!
);
if
(
newFilter
!=
_filter
)
{
_filter
=
newFilter
;
getUpdate
();
...
...
@@ -201,7 +200,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
@override
void
didUpdateWidget
(
GetBuilder
oldWidget
)
{
super
.
didUpdateWidget
(
oldWidget
as
GetBuilder
<
T
?
>);
super
.
didUpdateWidget
(
oldWidget
as
GetBuilder
<
T
>);
// to avoid conflicts when modifying a "grouped" id list.
if
(
oldWidget
.
id
!=
widget
.
id
)
{
_subscribeToController
();
...
...
@@ -215,7 +214,7 @@ class _GetBuilderState<T extends GetxController?> extends State<GetBuilder<T?>>
// model: controller,
// child: widget.builder(controller),
// );
return
widget
.
builder
(
controller
);
return
widget
.
builder
(
controller
!
);
}
}
...
...
lib/get_state_manager/src/simple/get_widget_cache.dart
View file @
bd20550
...
...
@@ -21,7 +21,7 @@ class GetWidgetCacheElement extends ComponentElement {
@override
void
mount
(
Element
?
parent
,
dynamic
newSlot
)
{
cache
?
.
onInit
();
cache
.
onInit
();
super
.
mount
(
parent
,
newSlot
);
}
...
...
lib/get_state_manager/src/simple/mixin_state.dart
View file @
bd20550
...
...
@@ -23,8 +23,7 @@ class MixinBuilder<T extends GetxController> extends StatelessWidget {
this
.
id
,
this
.
didChangeDependencies
,
this
.
didUpdateWidget
,
})
:
assert
(
builder
!=
null
),
super
(
key:
key
);
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
...
...
lib/get_state_manager/src/simple/simple_builder.dart
View file @
bd20550
...
...
@@ -64,7 +64,7 @@ class _ValueBuilderState<T> extends State<ValueBuilder<T?>> {
@override
void
dispose
()
{
super
.
dispose
();
widget
?
.
onDispose
?.
call
();
widget
.
onDispose
?.
call
();
if
(
value
is
ChangeNotifier
)
{
(
value
as
ChangeNotifier
?)?.
dispose
();
}
else
if
(
value
is
StreamController
)
{
...
...
@@ -78,9 +78,7 @@ class _ValueBuilderState<T> extends State<ValueBuilder<T?>> {
class
SimpleBuilder
extends
StatefulWidget
{
final
Widget
Function
(
BuildContext
)
builder
;
const
SimpleBuilder
({
Key
?
key
,
required
this
.
builder
})
:
assert
(
builder
!=
null
),
super
(
key:
key
);
const
SimpleBuilder
({
Key
?
key
,
required
this
.
builder
})
:
super
(
key:
key
);
@override
_SimpleBuilderState
createState
()
=>
_SimpleBuilderState
();
...
...
lib/get_utils/src/extensions/internacionalization.dart
View file @
bd20550
...
...
@@ -10,7 +10,8 @@ extension Trans on String? {
// whether the key is also present.
if
(
Get
.
translations
.
containsKey
(
"
${Get.locale!.languageCode}
_
${Get.locale!.countryCode}
"
)
&&
Get
.
translations
[
"
${Get.locale!.languageCode}
_
${Get.locale!.countryCode}
"
]!
Get
.
translations
[
"
${Get.locale!.languageCode}
_
${Get.locale!.countryCode}
"
]!
.
containsKey
(
this
))
{
return
Get
.
translations
[
"
${Get.locale!.languageCode}
_
${Get.locale!.countryCode}
"
]![
this
!];
...
...
lib/get_utils/src/get_utils/get_utils.dart
View file @
bd20550
...
...
@@ -214,7 +214,7 @@ class GetUtils {
/// Checks if string is phone number.
static
bool
isPhoneNumber
(
String
s
)
{
if
(
s
==
null
||
s
.
length
>
16
||
s
.
length
<
9
)
return
false
;
if
(
s
.
length
>
16
||
s
.
length
<
9
)
return
false
;
return
hasMatch
(
s
,
r'^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$'
);
}
...
...
@@ -413,10 +413,6 @@ class GetUtils {
//Check if num is a cnpj
static
bool
isCnpj
(
String
cnpj
)
{
if
(
cnpj
==
null
)
{
return
false
;
}
// Obter somente os números do CNPJ
final
numbers
=
cnpj
.
replaceAll
(
RegExp
(
r'[^0-9]'
),
''
);
...
...
@@ -466,9 +462,9 @@ class GetUtils {
/// Checks if the cpf is valid.
static
bool
isCpf
(
String
cpf
)
{
if
(
cpf
==
null
)
{
return
false
;
}
// if (cpf == null) {
// return false;
// }
// get only the numbers
final
numbers
=
cpf
.
replaceAll
(
RegExp
(
r'[^0-9]'
),
''
);
...
...
test/benchmarks/benckmark_test.dart
View file @
bd20550
...
...
@@ -148,7 +148,7 @@ referenceValue is ${calculePercentage(referenceValue, requestedValue)}% more tha
print
(
'GetValue delay
$getx
ms to made
$times
requests'
);
print
(
'-----------'
);
print
(
'''
GetValue is
${calculePercentage(dart, getx).round()}
% more fast than Default ValueNotifier with
$times
listener
s'''
);
GetValue is
${calculePercentage(dart, getx).round()}
% more fast than Default ValueNotifier with
$times
request
s'''
);
});
test
(
'run benchmarks from Streams'
,
()
async
{
...
...
@@ -161,7 +161,7 @@ GetValue is ${calculePercentage(dart, getx).round()}% more fast than Default Val
var
dart
=
await
stream
();
print
(
'-----------'
);
print
(
'''
GetStream is
${calculePercentage(dart, mini).round()}
% more fast than Default Stream with
$times
listener
s'''
);
GetStream is
${calculePercentage(dart, mini).round()}
% more fast than Default Stream with
$times
request
s'''
);
print
(
'-----------'
);
times
=
30000
;
...
...
@@ -179,7 +179,7 @@ GetStream is ${calculePercentage(dart, mini).round()}% more fast than Default St
print
(
'getx_mini_stream delay
$mini
ms to made
$times
requests'
);
print
(
'-----------'
);
print
(
'''
GetStream is
${calculePercentage(dart, mini).round()}
% more fast than Default Stream with
$times
listener
s'''
);
GetStream is
${calculePercentage(dart, mini).round()}
% more fast than Default Stream with
$times
request
s'''
);
});
}
...
...
test/navigation/root_widget_test.dart
View file @
bd20550
import
'package:flutter_test/flutter_test.dart'
;
import
'package:get/get.dart'
;
// import 'package:flutter_test/flutter_test.dart';
// import 'package:get/get.dart';
void
main
(
)
{
// testWidgets(
...
...
test/navigation/routes_test.dart
View file @
bd20550
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:get/get.dart'
;
// import 'package:flutter/material.dart';
// import 'package:flutter_test/flutter_test.dart';
// import 'package:get/get.dart';
void
main
(
)
{
// testWidgets(
...
...
@@ -24,7 +24,8 @@ void main() {
// "GetPage name null",
// (tester) async {
// expect(
// () => GetPage(page: () => Scaffold(), maintainState: null, name: null),
// () => GetPage(page: () => Scaffold(),
// maintainState: null, name: null),
// throwsAssertionError,
// );
// },
...
...
test/rx/rx_workers_test.dart
View file @
bd20550
...
...
@@ -6,9 +6,9 @@ import 'package:get/get.dart';
void
main
(
)
{
test
(
'once'
,
()
async
{
final
count
=
0
.
obs
;
int
?
result
=
-
1
;
var
result
=
-
1
;
once
(
count
,
(
dynamic
_
)
{
result
=
_
as
int
?
;
result
=
_
as
int
;
});
count
.
value
++;
await
Future
.
delayed
(
Duration
.
zero
);
...
...
@@ -23,9 +23,9 @@ void main() {
test
(
'ever'
,
()
async
{
final
count
=
0
.
obs
;
int
?
result
=
-
1
;
ever
(
count
,
(
dynamic
_
)
{
result
=
_
as
int
?;
var
result
=
-
1
;
ever
<
int
>(
count
,
(
value
)
{
result
=
value
;
});
count
.
value
++;
await
Future
.
delayed
(
Duration
.
zero
);
...
...
test/state_manager/get_state_test.dart
View file @
bd20550
...
...
@@ -68,18 +68,18 @@ void main() {
expect
(
find
.
text
(
"single 0"
),
findsOneWidget
);
});
testWidgets
(
"MixinBuilder with build null"
,
(
test
)
async
{
expect
(
()
=>
GetBuilder
<
Controller
>(
init:
Controller
(),
builder:
null
,
),
throwsAssertionError
,
);
},
);
// testWidgets(
// "MixinBuilder with build null",
// (test) async {
// expect(
// () => GetBuilder<Controller>(
// init: Controller(),
// builder: null,
// ),
// throwsAssertionError,
// );
// },
// );
}
class
Controller
extends
GetxController
{
...
...
Please
register
or
login
to post a comment