onData method

void onData(
  1. SubscriptionUpdate message
)

Implementation

void onData(SubscriptionUpdate message) {
  var cmdId = message.subscriptionId;
  List<String>? keys;
  var foundCmd =
      _subscriptionCommands.where((command) => command.cmdId == cmdId);
  if (foundCmd.isNotEmpty) {
    var cmd = foundCmd.first;
    var telemetryPluginCmd = cmd as TelemetryPluginCmd;
    if (telemetryPluginCmd.keys != null &&
        telemetryPluginCmd.keys!.isNotEmpty) {
      keys = telemetryPluginCmd.keys!.split(',');
    }
  }
  message.prepareData(keys);
  _dataStreamController.add(message);
}