EarnedReward class

Represents a reward that a user has earned.

This class is designed to map directly to the backend's EarnedRewardsResponse object, typically used for deserializing API responses. It contains information about rewards that users have successfully claimed or earned through their driving achievements and accumulated points.

Constructors

EarnedReward({int? id, int? rewardId, String? rewardCode, String? title, String? description, int? points, String? earnedOn})
const
EarnedReward.fromJson(Map<String, dynamic> json)
Factory constructor to create an instance from JSON.
factory

Properties

description String?
Detailed description of the earned reward. Contains information about the reward benefits, usage instructions, and any applicable terms and conditions. Example: "Get a free coffee at participating locations. Valid for 30 days."
final
earnedOn String?
ISO 8601 formatted timestamp of when the reward was earned. Indicates the exact date and time when the user claimed this reward. Example: "2024-01-15T10:30:00Z"
final
hashCode int
The hash code for this object.
no setteroverride
id int?
Unique identifier for the earned reward record. This is different from the original reward ID and represents the specific instance of when this reward was earned by the user.
final
points int?
Number of points that were spent to earn this reward. This represents the cost that was deducted from the user's point balance. Example: 100, 250, 500
final
rewardCode String?
Unique code identifier for the earned reward. Same as the original reward code, used for redemption tracking. Example: "COFFEE_VOUCHER_10", "GAS_DISCOUNT_5"
final
rewardId int?
Reference to the original reward's unique identifier. This links back to the AvailableReward that was claimed. Used to fetch additional reward details if needed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
title String?
Display title of the earned reward. This is the name of the reward that was claimed. Example: "Free Coffee Voucher", "5% Gas Discount"
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts the instance to a JSON map.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override