Device constructor

Device(
  1. Map map
)

Constructo of Device

Implementation

Device(Map map) {
  map.forEach((key, value) {
    switch (key) {
      case _MAP_ENABLE:
        isEnabled = value.toString() == "true";
        break;
      case _MAP_DEVICE_ID:
        deviceId = value.toString();
        break;
      case _MAP_PUSH_TOKEN:
        pushToken = value.toString();
        break;
      case _MAP_PLATFORM:
        platform = value.toString();
        break;
      case _MAP_VERSION:
        version = value.toString();
        break;
      case _MAP_PRODUCT_NAME:
        productName = value.toString();
        break;
      case _MAP_PRODUCT_VERSION:
        productVersion = value.toString();
        break;
      case _MAP_OS_NAME:
        osName = value.toString();
        break;
      case _MAP_OS_VERSION:
        osVersion = value.toString();
        break;
      case _MAP_DEVICE_BRAND:
        deviceBrand = value.toString();
        break;
      case _MAP_DEVICE_MODEL:
        deviceModel = value.toString();
        break;
      case _MAP_OPERATOR:
        operator = value.toString();
        break;
      case _MAP_DEVICE_TYPE:
        deviceType = value.toString();
        break;
      case _MAP_APP_VERSION:
        appVersion = value.toString();
        break;
      case _MAP_LOCALE:
        locale = value.toString();
        break;
      case _MAP_TIME_ZONE:
        timeZone = value.toString();
        break;
      case _MAP_TIME_OFFSET:
        timeOffset = int.parse(value.toString());
        break;
      case _MAP_EXTERNAL_CODE:
        externalCode = value.toString();
        break;
      case _MAP_EXTERNAL_APPS:
        {
          String externalAppsString = value.toString();
          externalApps = ExternalApp.createArray(
              "{\"" + key + "\":" + externalAppsString + "}");
        }
        break;
    }
  });
}