processAllBlocksAsync method
Processes blocks in a background isolate, yielding one UDPipeResult
per block. Keeps the UI thread free for large inputs.
Implementation
Future<List<UDPipeResult>> processAllBlocksAsync(List<String> blocks) async {
if (!isAvailable) return List.filled(blocks.length, UDPipeResult.empty);
if (kIsWeb) return processBatchPerBlock(blocks);
final dllPath = _resolveDllPath();
if (dllPath == null) return List.filled(blocks.length, UDPipeResult.empty);
final handleAddr = _handle!.address;
_processingCount++;
try {
return await Isolate.run(() => _processAllBlocksInIsolate(dllPath, handleAddr, blocks));
} finally {
_processingCount--;
if (_processingCount == 0 && _deferredFreeHandle != null) {
_bindings?.free(_deferredFreeHandle!);
_deferredFreeHandle = null;
}
}
}