PmbDevice.fromJson constructor

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

Implementation

PmbDevice.fromJson(Map<String, dynamic> json) {
  if (json["id"] is String) id = json["id"];
  if (json["serial"] is String) serial = json["serial"];
  if (json["label"] is String) label = json["label"];
  publicName = json["publicName"];
  purchasedAt = json["purchasedAt"];
  warrantyUntil = json["warrantyUntil"];
  if (json["qrCodeDevice"] is String) {
    qrCodeDevice = json["qrCodeDevice"];
  }
  if (json["lat"] is double) lat = json["lat"];
  if (json["lng"] is double) lng = json["lng"];
  if (json["closeOpenSchedule"] is int) {
    closeOpenSchedule = json["closeOpenSchedule"];
  }
  if (json["readyToPour"] is int) readyToPour = json["readyToPour"];
  if (json["amountRent"] is int) amountRent = json["amountRent"];
  if (json["amountBuy"] is int) amountBuy = json["amountBuy"];
  if (json["currency"] is String) currency = json["currency"];
  if (json["width"] is int) width = json["width"];
  if (json["height"] is int) height = json["height"];
  if (json["depth"] is int) depth = json["depth"];
  if (json["numberOfPumps"] is int) {
    numberOfPumps = json["numberOfPumps"];
  }
  if (json["debitPerSec"] is int) debitPerSec = json["debitPerSec"];
  if (json["distance"] is int) distance = json["distance"];
  if (json["beers"] is List) {
    beers = json["beers"] == null
        ? null
        : (json["beers"] as List).map((e) => Beers.fromJson(e)).toList();
  }
}