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
2023-02-25 18:25:44 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c2ef56ad3d3312f636c8c4955b8eaae726613ddf
c2ef56ad
1 parent
c900d07d
format files
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
36 deletions
lib/get_connect/http/src/http.dart
lib/get_connect/http/src/http/io/http_request_io.dart
lib/get_core/src/flutter_engine.dart
lib/get_navigation/src/bottomsheet/bottomsheet.dart
lib/get_state_manager/src/rx_flutter/rx_notifier.dart
lib/get_utils/src/extensions/num_extensions.dart
lib/get_connect/http/src/http.dart
View file @
c2ef56a
...
...
@@ -16,7 +16,8 @@ typedef Decoder<T> = T Function(dynamic data);
typedef
Progress
=
Function
(
double
percent
);
typedef
ResponseInterceptor
<
T
>
=
Future
<
Response
<
T
>?>
Function
(
Request
<
T
>
request
,
Type
targetType
,
HttpClientResponse
response
);
typedef
ResponseInterceptor
<
T
>
=
Future
<
Response
<
T
>?>
Function
(
Request
<
T
>
request
,
Type
targetType
,
HttpClientResponse
response
);
class
GetHttpClient
{
String
userAgent
;
...
...
@@ -156,16 +157,15 @@ class GetHttpClient {
final
uri
=
_createUri
(
url
,
query
);
return
Request
<
T
>(
method:
method
,
url:
uri
,
headers:
headers
,
bodyBytes:
bodyStream
,
contentLength:
bodyBytes
?.
length
??
0
,
followRedirects:
followRedirects
,
maxRedirects:
maxRedirects
,
decoder:
decoder
,
responseInterceptor:
responseInterceptor
);
method:
method
,
url:
uri
,
headers:
headers
,
bodyBytes:
bodyStream
,
contentLength:
bodyBytes
?.
length
??
0
,
followRedirects:
followRedirects
,
maxRedirects:
maxRedirects
,
decoder:
decoder
,
responseInterceptor:
responseInterceptor
);
}
void
_setContentLenght
(
Map
<
String
,
String
>
headers
,
int
contentLength
)
{
...
...
@@ -291,11 +291,14 @@ class GetHttpClient {
));
}
ResponseInterceptor
<
T
>?
_responseInterceptor
<
T
>(
ResponseInterceptor
<
T
>?
actual
)
{
if
(
actual
!=
null
)
return
actual
;
ResponseInterceptor
<
T
>?
_responseInterceptor
<
T
>(
ResponseInterceptor
<
T
>?
actual
)
{
if
(
actual
!=
null
)
return
actual
;
final
defaultInterceptor
=
defaultResponseInterceptor
;
return
defaultInterceptor
!=
null
?
(
request
,
targetType
,
response
)
async
=>
await
defaultInterceptor
(
request
,
targetType
,
response
)
as
Response
<
T
>?
?
(
request
,
targetType
,
response
)
async
=>
await
defaultInterceptor
(
request
,
targetType
,
response
)
as
Response
<
T
>?
:
null
;
}
...
...
@@ -340,6 +343,7 @@ class GetHttpClient {
responseInterceptor:
_responseInterceptor
(
responseInterceptor
),
);
}
Future
<
Response
<
T
>>
send
<
T
>(
Request
<
T
>
request
)
async
{
try
{
var
response
=
await
_performRequest
<
T
>(()
=>
Future
.
value
(
request
));
...
...
@@ -582,17 +586,16 @@ class GetHttpClient {
// return completer.future;
// }
Future
<
Response
<
T
>>
delete
<
T
>(
String
url
,
{
Map
<
String
,
String
>?
headers
,
String
?
contentType
,
Map
<
String
,
dynamic
>?
query
,
Decoder
<
T
>?
decoder
,
ResponseInterceptor
<
T
>?
responseInterceptor
})
async
{
Future
<
Response
<
T
>>
delete
<
T
>(
String
url
,
{
Map
<
String
,
String
>?
headers
,
String
?
contentType
,
Map
<
String
,
dynamic
>?
query
,
Decoder
<
T
>?
decoder
,
ResponseInterceptor
<
T
>?
responseInterceptor
})
async
{
try
{
var
response
=
await
_performRequest
<
T
>(
()
async
=>
_delete
<
T
>(
url
,
contentType
,
query
,
decoder
,
responseInterceptor
),
()
async
=>
_delete
<
T
>(
url
,
contentType
,
query
,
decoder
,
responseInterceptor
),
headers:
headers
,
);
return
response
;
...
...
lib/get_connect/http/src/http/io/http_request_io.dart
View file @
c2ef56a
...
...
@@ -8,7 +8,6 @@ import '../../response/response.dart';
import
'../interface/request_base.dart'
;
import
'../utils/body_decoder.dart'
;
/// A `dart:io` implementation of `HttpRequestBase`.
class
HttpRequestImpl
extends
HttpRequestBase
{
io
.
HttpClient
?
_httpClient
;
...
...
@@ -58,10 +57,11 @@ class HttpRequestImpl extends HttpRequestBase {
});
final
bodyBytes
=
(
response
);
final
interceptionResponse
=
await
request
.
responseInterceptor
?.
call
(
request
,
T
,
response
);
if
(
interceptionResponse
!=
null
)
return
interceptionResponse
;
final
interceptionResponse
=
await
request
.
responseInterceptor
?.
call
(
request
,
T
,
response
);
if
(
interceptionResponse
!=
null
)
return
interceptionResponse
;
final
stringBody
=
await
bodyBytesToString
(
bodyBytes
,
headers
);
final
body
=
bodyDecoded
<
T
>(
...
...
lib/get_core/src/flutter_engine.dart
View file @
c2ef56a
import
'package:flutter/widgets.dart'
;
class
Engine
{
static
WidgetsBinding
get
instance
{
class
Engine
{
static
WidgetsBinding
get
instance
{
return
WidgetsFlutterBinding
.
ensureInitialized
();
}
}
\ No newline at end of file
}
...
...
lib/get_navigation/src/bottomsheet/bottomsheet.dart
View file @
c2ef56a
...
...
@@ -66,12 +66,11 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
@override
Animation
<
double
>
createAnimation
()
{
if
(
curve
!=
null
)
{
return
CurvedAnimation
(
curve:
curve
!,
parent:
_animationController
!.
view
);
return
CurvedAnimation
(
curve:
curve
!,
parent:
_animationController
!.
view
);
}
return
_animationController
!.
view
;
}
@override
AnimationController
createAnimationController
()
{
assert
(
_animationController
==
null
);
...
...
lib/get_state_manager/src/rx_flutter/rx_notifier.dart
View file @
c2ef56a
...
...
@@ -71,7 +71,7 @@ mixin StateMixin<T> on ListNotifier {
}
}
void
futurize
(
Future
<
T
>
Function
()
body
,
void
futurize
(
Future
<
T
>
Function
()
body
,
{
T
?
initialData
,
String
?
errorMessage
,
bool
useEmpty
=
true
})
{
final
compute
=
body
;
_value
??=
initialData
;
...
...
lib/get_utils/src/extensions/num_extensions.dart
View file @
c2ef56a
...
...
@@ -64,5 +64,4 @@ extension GetNumUtils on num {
// _delayMaps.remove(callback);
// }
//}
}
...
...
Please
register
or
login
to post a comment