TileSetDetail.fromJson constructor

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

Implementation

TileSetDetail.fromJson(Map<String, dynamic> json) {
  firsTgId = json['firstgid'];
  source = json['source'];
  backgroundColor = json['backgroundcolor'];
  columns = json['columns'];
  image = json['image'];
  imageHeight = double.tryParse(json['imageheight'].toString()) ?? 0.0;
  imageWidth = double.tryParse(json['imagewidth'].toString()) ?? 0.0;
  margin = double.tryParse(json['margin'].toString()) ?? 0.0;
  name = json['name'];
  objectAlignment = json['objectalignment'];
  spacing = double.tryParse(json['spacing'].toString()) ?? 0.0;
  tileCount = json['tilecount'];
  tiledVersion = json['tiledversion'];
  tileHeight = double.tryParse(json['tileheight'].toString()) ?? 0.0;
  tileWidth = double.tryParse(json['tilewidth'].toString()) ?? 0.0;
  transparentColor = json['transparentcolor'];
  version = double.tryParse(json['version'].toString()) ?? 0.0;
  type = json['type'];
  if (json['properties'] != null) {
    properties = <Property>[];
    json['properties'].forEach((v) {
      properties?.add(Property.fromJson(v));
    });
  }
  if (json['terrains'] != null) {
    terrains = [];
    json['terrains'].forEach((v) {
      terrains?.add(v);
    });
  }
  if (json['wangsets'] != null) {
    wangSets = [];
    json['wangsets'].forEach((v) {
      wangSets?.add(WangSet.fromJson(v));
    });
  }
  if (json['tiles'] != null) {
    tiles = <TileSetItem>[];
    json['tiles'].forEach((v) {
      tiles?.add(TileSetItem.fromJson(v));
    });
  }
}