fromJson static method

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

Implementation

static GiftsForCrafting? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return GiftsForCrafting(
    totalCount: (json['total_count'] as int?) ?? 0,
    gifts: List<ReceivedGift>.from(
      tdListFromJson(json['gifts'])
          .map((item) => ReceivedGift.fromJson(tdMapFromJson(item)))
          .whereType<ReceivedGift>(),
    ),
    attributePersistenceProbabilities:
        List<AttributeCraftPersistenceProbability>.from(
          tdListFromJson(json['attribute_persistence_probabilities'])
              .map(
                (item) => AttributeCraftPersistenceProbability.fromJson(
                  tdMapFromJson(item),
                ),
              )
              .whereType<AttributeCraftPersistenceProbability>(),
        ),
    nextOffset: (json['next_offset'] as String?) ?? '',
  );
}