Body.fromJson constructor

Body.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Body.fromJson(Map<String, dynamic> json) {
  final responseType = json.keys.firstWhere((key) => key != 'fault');

  final responseMap = json[responseType] as Map<String, dynamic>;

  return Body(
    fault: json['Fault'] == null ? null : Fault.fromJson(json['Fault']),
    response: responseMap.entries.isEmpty ? json : responseMap,
  );
}