toJson method

  1. @override
Map<String, dynamic> toJson()
override

Converts the MPPoint to a JSON representation that can be parsed by the MapsIndoors Platform SDK

Implementation

@override
Map<String, dynamic> toJson() {
  if (_lat == null || _lng == null) {
    return {
      "coordinates": [0.0, 0.0],
      "type": type
    };
  }
  List<num> coords = [longitude, latitude];

  if (_floorIndex != null) {
    coords.add(_floorIndex!);
  }

  return {"coordinates": coords, "type": type};
}