CheckReward.fromJson constructor

CheckReward.fromJson(
  1. Map<String, dynamic> json
)

Creates a CheckReward instance from a JSON map.

The json parameter should contain the following keys:

  • 'offers': A list of offers associated with the reward.
  • 'reward': The total reward value received.

Implementation

factory CheckReward.fromJson(Map<String, dynamic> json) {
  var offersList = (json['offers'] as List)
      .map((offerJson) => Offer.fromJson(offerJson))
      .toList();

  return CheckReward(
    offers: offersList,
    reward: (json['reward'] as num).toDouble(),
  );
}