BaseHit.fromMap constructor

BaseHit.fromMap(
  1. String oldId,
  2. Map body
)

Implementation

BaseHit.fromMap(String oldId, Map body) {
  try {
    this.id = oldId; // Keep the same id in db
    // Set the created date
    this.createdAt = DateTime.parse(body['createdAt']);
    // Set CLient Id
    this.clientId = body["cid"] ?? "";
    // Set the id of visitor
    this.visitorId = body["vid"] ?? "";
    this.anonymousId = body["cuid"];
    // Data Source
    this.dataSource = body["ds"] ?? "APP";
    // Screen resolution
    this.screenResolution = body["sr"];
    // user language
    this.userLanguage = body['ul'];
    // Session number
    this.sessionNumber = body['sn'];
  } catch (e) {
    Flagship.logger(Level.DEBUG, "Error on parsing hit from map, $e");
  }
}