createIdentify method

Identify createIdentify(
  1. Map<String, dynamic> userProperties
)

Implementation

Identify createIdentify(Map<String, dynamic> userProperties) {
  Identify identify = new Identify();
  userProperties.forEach((String operation, dynamic properties) {
    properties.forEach((String key, dynamic value) {
      switch (operation) {
        case "\$add":
          {
            identify.add(key, value);
            break;
          }

        case "\$append":
          {
            identify.append(key, value);
            break;
          }
        case "\$prepend":
          {
            identify.prepend(key, value);
            break;
          }
        case "\$set":
          {
            identify.set(key, value);
            break;
          }
        case "\$setOnce":
          {
            identify.setOnce(key, value);
            break;
          }
        case "\$unset":
          {
            identify.unset(key);
            break;
          }
        case "\$preInsert":
          {
            identify.preInsert(key, value);
            break;
          }
        case "\$postInsert":
          {
            identify.postInsert(key, value);
            break;
          }
        case "\$remove":
          {
            identify.remove(key, value);
            break;
          }
        case "\$clearAll":
          {
            identify.clearAll();
            break;
          }
        default:
          break;
      }
    });
  });
  return identify;
}