fromJson static method
Inherited by: AuctionStateActive AuctionStateFinished
Implementation
static AuctionStateActive? fromJson(Map<String, dynamic>? json) {
if (json == null) {
return null;
}
return AuctionStateActive(
startDate: (json['start_date'] as int?) ?? 0,
endDate: (json['end_date'] as int?) ?? 0,
minBid: (json['min_bid'] as int?) ?? 0,
bidLevels: List<AuctionBid>.from(
tdListFromJson(json['bid_levels'])
.map((item) => AuctionBid.fromJson(tdMapFromJson(item)))
.whereType<AuctionBid>(),
),
topBidderUserIds: List<int>.from(
tdListFromJson(
json['top_bidder_user_ids'],
).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
),
rounds: List<AuctionRound>.from(
tdListFromJson(json['rounds'])
.map((item) => AuctionRound.fromJson(tdMapFromJson(item)))
.whereType<AuctionRound>(),
),
currentRoundEndDate: (json['current_round_end_date'] as int?) ?? 0,
currentRoundNumber: (json['current_round_number'] as int?) ?? 0,
totalRoundCount: (json['total_round_count'] as int?) ?? 0,
distributedItemCount: (json['distributed_item_count'] as int?) ?? 0,
leftItemCount: (json['left_item_count'] as int?) ?? 0,
acquiredItemCount: (json['acquired_item_count'] as int?) ?? 0,
userBid: UserAuctionBid.fromJson(tdMapFromJson(json['user_bid'])),
);
}