getHCPData method

Future<HCP?> getHCPData()

Implementation

Future<HCP?> getHCPData() async {

  // _libraryData.getValue("user").then((value) => Logger(_TAG).log("User ${value}"));
  String data = jsonEncode(await _libraryData.getValue("user"));
  // var mapdata = json.decode(data);

  var obj = jsonDecode(jsonDecode(data).toString());
  if(obj == null){
    return null;
  }
  var hcp = HcpBuilder();
  hcp.hcpId = obj["hcpId"] as String?;
  hcp.hashedHcpId = obj["hashedHcpId"] as String?;
  hcp.firstName = obj["firstName"] as String?;
  hcp.lastName = obj["lastName"] as String?;
  hcp.specialization = obj["specialization"] as String?;
  hcp.organisation = obj["organisation"] as String?;
  hcp.zipCode = obj["zipCode"] as String?;
  hcp.city = obj["city"] as String?;
  hcp.gender = obj["gender"] as String?;
  hcp.email = obj["email"] as String?;
  hcp.mobile = obj["mobile"] as String?;
  hcp.dob = obj["DOB"] as String?;
  hcp.wl = obj["WL"] as String?;
  hcp.state = obj["State"] as String?;
  hcp.country = obj["Country"] as String?;

  return hcp.build();
}