PublishEvent.fromMap constructor

PublishEvent.fromMap(
  1. Map<String, dynamic> data
)

Implementation

PublishEvent.fromMap(Map<String, dynamic> data) {
  hashed = data["hashed"];

  List units = data["units"] ?? [];
  this.units =
      List.generate(units.length, (index) => Unit.fromMap(units[index]));
  publishedAt = data["publishedAt"];
  List exposures = data["exposures"] ?? [];
  this.exposures = List.generate(
      exposures.length, (index) => Exposure.fromMap(exposures[index]));

  List goals = data["goals"] ?? [];
  this.goals = List.generate(
      goals.length, (index) => GoalAchievement.fromMap(goals[index]));

  List attributes = data["attributes"] ?? [];
  this.attributes = List.generate(
      attributes.length, (index) => Attribute.fromMap(attributes[index]));
}