map method
Maps a source object to the target type
source - The source object to map
Implementation
@override
Response map(PHttpResponse source) {
return switch (source.data) {
Stream<List<int>> s =>
Response.stream(
statusCode: source.statusCode,
headers: source.headers,
body: s,
),
_ =>
Response(
statusCode: source.statusCode,
headers: source.headers,
body: switch (source.data) {
String s => s,
Map<String, dynamic> s => jsonEncode(s),
_ => source.data,
},
),
};
}