processBytes method
Processes raw byte buffer directly from memory.
Implementation
Future<ScanResult> processBytes(
Uint8List bytes,
ScanMode mode, {
int width = 640,
int height = 480,
}) async {
initialize();
try {
final inputImage = InputImage.fromBytes(
bytes: bytes,
metadata: InputImageMetadata(
size: Size(width.toDouble(), height.toDouble()),
rotation: InputImageRotation.rotation0deg,
format: InputImageFormat.nv21,
bytesPerRow: width,
),
);
return await processInputImage(inputImage, mode);
} catch (e) {
return ScanResult.error(mode, 'Failed to process raw bytes: ${e.toString()}');
}
}