mapToQBCustomObject static method

QBCustomObject? mapToQBCustomObject(
  1. Map? map
)

Implementation

static QBCustomObject? mapToQBCustomObject(Map<dynamic, dynamic>? map) {
  if (map == null || map.length <= 0) {
    return null;
  }

  QBCustomObject customObject = QBCustomObject();

  if (map.containsKey("id")) {
    customObject.id = map["id"] as String?;
  }
  if (map.containsKey("parentId")) {
    customObject.parentId = map["parentId"] as String?;
  }
  if (map.containsKey("createdAt")) {
    customObject.createdAt = map["createdAt"] as String?;
  }
  if (map.containsKey("updatedAt")) {
    customObject.updatedAt = map["updatedAt"] as String?;
  }
  if (map.containsKey("className")) {
    customObject.className = map["className"] as String?;
  }
  if (map.containsKey("userId")) {
    customObject.userId = map["userId"] as int?;
  }
  if (map.containsKey("fields")) {
    Map<String, Object> fieldsMap =
        Map.from(map["fields"] as Map<dynamic, dynamic>);
    customObject.fields = fieldsMap;
  }
  if (map.containsKey("permission")) {
    Map<String, Object> permissionMap =
        Map.from(map["permission"] as Map<dynamic, dynamic>);
    QBCustomObjectPermission permission =
        mapToQBCustomObjectPermission(permissionMap);
    customObject.permission = permission;
  }

  return customObject;
}