createLogDataSource static method
- String logPath
Create a log-based data source from a log file.
Opens the specified log file for playback as a DataSource. Supported formats
include GPX and other common trace formats; .gm proprietary log files are not supported here.
Parameters
logPath: Path to the log file to use for playback.
Returns
- DataSource?: The created playback data source, or null if the file could not be opened.
Implementation
static DataSource? createLogDataSource(final String logPath) {
final String resultString = GemKitPlatform.instance.callCreateObject(
jsonEncode(<String, Object>{
'class': 'DataSourceContainer',
'args': <String, String>{'type': 'log', 'path': logPath},
}),
);
final dynamic decodedVal = jsonDecode(resultString);
final int gemApiError = decodedVal['gemApiError'];
if (GemErrorExtension.isErrorCode(gemApiError)) {
return null;
}
final DataSource retVal = DataSource.init(decodedVal['result']);
return retVal;
}