Path.create constructor
- required Uint8List data,
- PathFileFormat format = PathFileFormat.gpx,
Creates a Path by importing binary data in a supported format.
The data bytes contain the file contents (for example a GPX or KML
file). The format controls how the bytes are interpreted. The returned
Path instance is backed by the native SDK representation.
Parameters
data: Binary file contents as a Uint8List.format: Optional PathFileFormat describing the data format. Defaults to PathFileFormat.gpx.
Returns
- A new Path instance created from the provided data.
Implementation
factory Path.create({
required final Uint8List data,
final PathFileFormat format = PathFileFormat.gpx,
}) {
final dynamic nativeBuffer = GemKitPlatform.instance.toNativePointer(data);
final dynamic resultString = GemKitPlatform.instance.callCreateObject(
jsonEncode(<String, Object>{
'class': 'Path',
'args': <String, dynamic>{
'data': nativeBuffer.address,
'dataLength': data.length,
'format': format.id,
},
}),
);
GemKitPlatform.instance.freeNativePointer(nativeBuffer);
final dynamic decodedVal = jsonDecode(resultString);
return Path.init(decodedVal['result']);
}