AdTraceAttribution.fromMap constructor

AdTraceAttribution.fromMap(
  1. dynamic map
)

Implementation

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

    return AdTraceAttribution(
      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'],
    );
  } catch (e) {
    throw Exception(
        '[AdTraceFlutter]: Failed to create AdTraceAttribution object from given map object. Details: ' +
            e.toString());
  }
}