toResponse static method

HttpResponse toResponse({
  1. dynamic from,
})

Implementation

static HttpResponse toResponse({dynamic from}) {
  var json = tryCast<Map<Object?, Object?>>(from);
  int resCode = int.tryParse(json?["code"]?.toString() ?? "") ?? 0;
  String resMessage = json?["message"]?.toString() ?? "";
  String? resBody = json?["body"]?.toString();

  return HttpResponse(
    resCode,
    resMessage,
    resBody,
  );
}