MapLayer.fromJson constructor

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

Implementation

MapLayer.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  name = json['name'];
  layerClass = json['class'];
  offsetX = double.tryParse(json['offsetx'].toString()) ?? 0.0;
  offsetY = double.tryParse(json['offsety'].toString()) ?? 0.0;
  opacity = double.tryParse(json['opacity'].toString()) ?? 0.0;
  type = json['type'].toString().getTypeLayer();
  visible = json['visible'];
  x = double.tryParse(json['x'].toString()) ?? 0.0;
  y = double.tryParse(json['y'].toString()) ?? 0.0;
  if (json['properties'] != null) {
    properties = <Property>[];
    json['properties'].forEach((v) {
      properties?.add(Property.fromJson(v));
    });
  }
}