FastResponseAdAsset.fromJson constructor

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

Factory constructor to create a FastResponseAdAsset object from a JSON map.

Implementation

factory FastResponseAdAsset.fromJson(Map<String, dynamic> json) {
  var small = json['small'] as String?;
  var medium = json['medium'] as String?;
  var large = json['large'] as String?;

  if (small == null || !isValidUrl(small)) {
    small = null;
  }

  if (medium == null || !isValidUrl(medium)) {
    medium = null;
  }

  if (large == null || !isValidUrl(large)) {
    large = null;
  }

  return FastResponseAdAsset(small: small, medium: medium, large: large);
}