AdjustAttribution.fromMap constructor

AdjustAttribution.fromMap(
  1. dynamic map
)

Implementation

factory AdjustAttribution.fromMap(dynamic map) {
  try {
    double parsedCostAmount = -1;
    try {
      if (map['costAmount'] != null) {
        parsedCostAmount = double.parse(map['costAmount']);
      }
    } catch (ex) {}

    return AdjustAttribution(
      trackerToken: map['trackerToken'],
      trackerName: map['trackerName'],
      network: map['network'],
      campaign: map['campaign'],
      adgroup: map['adgroup'],
      creative: map['creative'],
      clickLabel: map['clickLabel'],
      adid: map['adid'],
      costType: map['costType'],
      costAmount: parsedCostAmount != -1 ? parsedCostAmount : null,
      costCurrency: map['costCurrency'],
      fbInstallReferrer: map['fbInstallReferrer'],
    );
  } catch (e) {
    throw Exception(
        '[AdjustFlutter]: Failed to create AdjustAttribution object from given map object. Details: ' +
            e.toString());
  }
}