onAck<T extends DataObject> method

void onAck<T extends DataObject>(
  1. void callback(
    1. Acknowledged<T> data
    )
)

Registers a callback for when an Acknowledged of a DataObject of type T is received.

Implementation

void onAck<T extends DataObject>(
  void Function(Acknowledged<T> data) callback,
) {
  _ackSubscriptions.add(
    acknowledgedPackets
        .where((ack) => ack.object is T)
        .map((ack) => ack.cast<T>())
        .listen(callback),
  );
}