AdEvent.fromJson constructor

AdEvent.fromJson(
  1. Map json
)

解析 AdEvent

Implementation

factory AdEvent.fromJson(Map<dynamic, dynamic> json) {
  String action = json['action'];
  if (action == AdEventAction.onAdError) {
    return AdErrorEvent.fromJson(json);
  } else if (action == AdEventAction.onAdReward) {
    return AdRewardEvent.fromJson(json);
  } else {
    return AdEvent(
      adId: json['adId'],
      action: action,
    );
  }
}