HttpResponse.fromJson constructor
HttpResponse.fromJson(
- Object? j
Implementation
factory HttpResponse.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return HttpResponse(
status: switch (json['status']) {
null => 0,
Object $1 => decodeInt($1),
},
reason: switch (json['reason']) {
null => '',
Object $1 => decodeString($1),
},
headers: switch (json['headers']) {
null => [],
List<Object?> $1 => [for (final i in $1) HttpHeader.fromJson(i)],
_ => throw const FormatException('"headers" is not a list'),
},
body: switch (json['body']) {
null => Uint8List(0),
Object $1 => decodeBytes($1),
},
);
}