MapAttributes constructor

MapAttributes(
  1. String instructions
)

Read json from the Map Instruction string.

Implementation

factory MapAttributes(String instructions) {
  final Map<String, dynamic> json = jsonDecode(instructions);

  return MapAttributes._(
    mapWidth: double.parse(json['w'].toString()),
    mapHeight: double.parse(json['h'].toString()),
    topLeft: LatLong.fromString(
      string: json['g']['a'] as String,
    ),
    bottomRight: LatLong.fromString(
      string: json['g']['b'] as String,
    ),
    drawingInstructions: List<Map<String, dynamic>>.from(json['i']),
  );
}