getLatestData method

SenseData? getLatestData(
  1. DataType type
)

Retrieves the latest produced SenseData of the requested type.

Returns the most recent sample for the given data type produced by the playback data source. If no data is available or an error occurs, this method returns null.

Parameters

  • type: The DataType to request (for example, DataType.position).

Returns

  • A SenseData instance when data is available, or null otherwise.

Implementation

SenseData? getLatestData(final DataType type) {
  final OperationResult resultString = objectMethod(
    pointerId,
    'PlaybackContainer',
    'getLatestPlaybackData',
    args: type.id,
  );

  if (resultString['gemApiError'] != 0) {
    return null;
  }

  final dynamic result = resultString['result'];
  if (result != null) {
    return senseFromJson(result);
  } else {
    return null;
  }
}