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
2022-11-05 14:35:58 -0300
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
GitHub
2022-11-05 14:35:58 -0300
Commit
b48da7f532b968882f49cfe60175dd84327049a3
b48da7f5
2 parents
14a76408
79ddfb5e
Merge pull request #2456 from shawon1fb/debouncer_null_safe
Debouncer null safe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
lib/get_connect/http/src/response/response.dart
lib/get_rx/src/rx_workers/utils/debouncer.dart
lib/get_connect/http/src/response/response.dart
View file @
b48da7f
...
...
@@ -7,7 +7,9 @@ import '../status/http_status.dart';
class
GraphQLResponse
<
T
>
extends
Response
<
T
>
{
final
List
<
GraphQLError
>?
graphQLErrors
;
GraphQLResponse
({
T
?
body
,
this
.
graphQLErrors
})
:
super
(
body:
body
);
GraphQLResponse
.
fromResponse
(
Response
res
)
:
graphQLErrors
=
null
,
super
(
...
...
@@ -31,6 +33,26 @@ class Response<T> {
this
.
body
,
});
Response
<
T
>
copyWith
({
Request
?
request
,
int
?
statusCode
,
Stream
<
List
<
int
>>?
bodyBytes
,
String
?
bodyString
,
String
?
statusText
,
Map
<
String
,
String
>?
headers
,
T
?
body
,
})
{
return
Response
<
T
>(
request:
request
??
this
.
request
,
statusCode:
statusCode
??
this
.
statusCode
,
bodyBytes:
bodyBytes
??
this
.
bodyBytes
,
bodyString:
bodyString
??
this
.
bodyString
,
statusText:
statusText
??
this
.
statusText
,
headers:
headers
??
this
.
headers
,
body:
body
??
this
.
body
,
);
}
/// The Http [Request] linked with this [Response].
final
Request
?
request
;
...
...
lib/get_rx/src/rx_workers/utils/debouncer.dart
View file @
b48da7f
...
...
@@ -9,14 +9,14 @@ import 'dart:async';
/// delayed( () => print( 'called after 1 sec' ));
/// ```
class
Debouncer
{
final
Duration
?
delay
;
final
Duration
delay
;
Timer
?
_timer
;
Debouncer
({
this
.
delay
});
Debouncer
({
required
this
.
delay
});
void
call
(
void
Function
()
action
)
{
_timer
?.
cancel
();
_timer
=
Timer
(
delay
!
,
action
);
_timer
=
Timer
(
delay
,
action
);
}
/// Notifies if the delayed call is active.
...
...
Please
register
or
login
to post a comment