Skip to content

Commit f0bc244

Browse files
committed
add acceptNullValue to the factory function
1 parent 93292c5 commit f0bc244

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/basic_api/request.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ import 'package:equatable/equatable.dart';
33
/// Super class of all requests.
44
class Request extends Equatable {
55
/// Initializes.
6-
Request({
6+
const Request({
77
this.msgType,
88
this.passthrough,
99
this.reqId,
1010
this.acceptNullValue = false,
1111
});
1212

1313
/// Generate an instance from JSON.
14-
factory Request.fromJson(Map<String, dynamic> json) => Request(
14+
factory Request.fromJson(
15+
{bool acceptNullValue = false, required Map<String, dynamic> json}) =>
16+
Request(
17+
acceptNullValue: acceptNullValue,
1518
passthrough: json['passthrough'] as Map<String, dynamic>?,
1619
reqId: json['req_id'] as int?,
1720
);
@@ -27,7 +30,7 @@ class Request extends Equatable {
2730
final int? reqId;
2831

2932
/// Determine accept null value in request or not.
30-
bool acceptNullValue;
33+
final bool acceptNullValue;
3134

3235
/// Converts an instance to JSON.
3336
Map<String, dynamic> toJson() => <String, dynamic>{

0 commit comments

Comments
 (0)