exportAs method

String exportAs(
  1. PathFileFormat pathFileFormat
)

Export path coordinates in the requested data format.

Serializes the path into a textual representation using the given format.

The returned string contains the full file content in the requested PathFileFormat (for example a GPX or GeoJSON document) and is suitable for writing to disk or sharing with other applications.

Parameters

Returns

  • A String containing the exported path data encoded in the chosen format.

Implementation

String exportAs(final PathFileFormat pathFileFormat) {
  final OperationResult resultString = objectMethod(
    pointerId,
    'Path',
    'exportAs',
    args: pathFileFormat.id,
  );

  final String encodedResult = resultString['result'];
  final Uint8List resultAsUint8List = base64Decode(encodedResult);
  final String result = utf8.decode(resultAsUint8List);

  return result;
}