GeofenceClient.fromJson constructor

GeofenceClient.fromJson(
  1. Map<String, dynamic> dataMap
)

Creates a GeofenceClient object from the JSON response to a GET request.

Implementation

factory GeofenceClient.fromJson(Map<String, dynamic> dataMap) {
  // Handle entire response given with no filter.
  Map<String, dynamic> data = MiscTools.extractData(dataMap);

  return GeofenceClient(
    type: ResourceType.fromString(data[ApiFields.type] ?? ""),
    id: data[ApiFields.id] ?? "",
    idV1: data[ApiFields.idV1] ?? "",
    name: data[ApiFields.name] ?? "",
    isAtHome: data[ApiFields.isAtHome],
  );
}