handleChunkReceived method
- DataStream_Chunk chunk
override
Implementation
@override
void handleChunkReceived(DataStream_Chunk chunk) {
final index = chunk.chunkIndex.toInt();
final previousChunkAtIndex = receivedChunks[index];
if (previousChunkAtIndex != null && previousChunkAtIndex.version > chunk.version) {
// we have a newer version already, dropping the old one
return;
}
receivedChunks[index] = chunk;
_bytesReceived += chunk.content.length;
validateBytesReceived();
final currentProgress = _totalByteSize != null ? _bytesReceived / _totalByteSize : null;
onProgress?.call(currentProgress);
}