readBytesOnListen method
void
readBytesOnListen()
readBytesOnListen can listen data in polling mode, endless loop, you can use onData
to get data.
dataPollingInterval
set data polling interval
Implementation
void readBytesOnListen(int bytesSize, Function(Uint8List value) onData,
{void onBefore()?,
Duration dataPollingInterval = const Duration(microseconds: 500)}) {
_readBytesSize = bytesSize;
readOnListenFunction = onData;
readOnBeforeFunction = onBefore ?? () {};
_readStream = _lookUpEvent(dataPollingInterval);
_readStream!.listen((event) {
readOnListenFunction(event);
});
}