This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit f312fd6 committed Mar 21, 2024 · 0 / 1 · Verified
1 parent 2985260 commit f312fd6 Copy full SHA for f312fd6
File tree 2 files changed +11
-2
lines changed
services/connection/call_manager
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ class Request extends Equatable {
7
7
this .msgType,
8
8
this .passthrough,
9
9
this .reqId,
10
+ this .acceptNullValue = false ,
10
11
});
11
12
12
13
/// Generate an instance from JSON.
@@ -25,6 +26,9 @@ class Request extends Equatable {
25
26
/// [Optional] Used to map request to response.
26
27
final int ? reqId;
27
28
29
+ /// Determine accept null value in request or not.
30
+ final bool acceptNullValue;
31
+
28
32
/// Converts an instance to JSON.
29
33
Map <String , dynamic > toJson () => < String , dynamic > {
30
34
'passthrough' : passthrough,
Original file line number Diff line number Diff line change @@ -105,8 +105,13 @@ abstract class BaseCallManager<T> {
105
105
required Request request,
106
106
required bool isSubscription,
107
107
}) {
108
- final Map <String , dynamic > result = request.toJson ()
109
- ..removeWhere ((String key, dynamic value) => value == null );
108
+ final Map <String , dynamic > result;
109
+ if (request.acceptNullValue) {
110
+ result = request.toJson ();
111
+ } else {
112
+ result = request.toJson ()
113
+ ..removeWhere ((String key, dynamic value) => value == null );
114
+ }
110
115
111
116
if (isSubscription) {
112
117
result.putIfAbsent ('subscribe' , () => 1 );
You can’t perform that action at this time.
0 commit comments