toJson method

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

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

Implementation

@override
Map<String, dynamic> toJson() {
  if (Platform.isIOS) {
    List<num>? coordinate;
    if (point != null) {
      coordinate = [point!._lng!, point!._lat!];
    }
    return {
      "coordinate": coordinate,
      "floorIndex": floorIndex,
      "bearing": bearing,
      "accuracy": accuracy,
      "providerName": provider.name
    };
  } else {
    return {
      "point": point,
      "floorIndex": floorIndex,
      "bearing": bearing,
      "accuracy": accuracy,
      "providerName": provider.name
    };
  }
}