createLogDataSource static method

DataSource? createLogDataSource(
  1. String logPath
)

Create a new log data source based on a log file

Parameters

  • IN logPath The log file path. The log file should not be a .gm file. Other formats such as .gpx are supported.

Throws

  • An exception if it fails

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;
}