Offer.fromJson constructor
Creates an Offer instance from a JSON map.
The json parameter should contain the following keys:
- 'status': The status of the offer.
- 'id': The unique identifier of the offer.
- 'name': The name of the offer.
- 'revenue': The revenue associated with the offer.
- 'reward': The reward value of the offer.
- 'transactionId': The transaction ID associated with the offer.
- 'time': The timestamp of the offer.
Implementation
factory Offer.fromJson(Map<String, dynamic> json) {
return Offer(
status: json['status'] as String,
id: json['id'] as String,
name: json['name'] as String,
revenue: (json['revenue'] as num).toDouble(),
reward: (json['reward'] as num).toDouble(),
transactionId: json['transactionId'] as String,
time: json['time'] as int,
);
}