On-Device Biometric Verification in Flutter: High Accuracy at 60 FPS
Engineering lessons from building Absensi RSD: running TensorFlow Lite facial embeddings on background isolates without freezing UI threads.
1. The Mobile Biometric Bottleneck
When building enterprise mobile attendance applications, face recognition must occur in real time so users immediately see visual feedback when their face is positioned correctly inside the camera viewfinder.
However, executing deep convolutional neural network inference on continuous 30 FPS camera frames will immediately saturate the single Dart UI thread, resulting in severe frame drops and janky animations.
2. Offloading Inference to Dart Isolates
The solution is architecting an asynchronous producer-consumer pipeline. The camera preview runs unhindered on the main thread, while downsampled YUV/RGB byte buffers are transmitted via SendPort to a long-lived Dart Isolate.
The isolate runs the TensorFlow Lite quantized model, computes the 128-dimensional facial embedding vector, and sends back lightweight coordinate bounding boxes and identity match confidence scores.
// Passing image buffer to isolate without blocking UI
Future<void> runInferenceInIsolate(CameraImage image) async {
if (_isProcessing) return; // Drop frame if previous inference still running
_isProcessing = true;
final responsePort = ReceivePort();
_isolateSendPort.send(InferenceMessage(
planes: image.planes.map((p) => p.bytes).toList(),
width: image.width,
height: image.height,
sendPort: responsePort.sendPort,
));
final result = await responsePort.first as RecognitionResult;
_isProcessing = false;
updateBoundingBoxes(result);
}3. Anti-Spoofing & Geofencing Integrity
A biometric face attendance system is only as secure as its physical location verification. To prevent mock-location spoofing, client payloads are cryptographically signed with on-device hardware keystore tokens before transmission to the backend validation server.
Wildan Silki Sawabiqil Abroor
Software Engineer & Web3 Specialist from Indonesia specializing in Full-Stack development (Next.js, Node.js), Smart Contracts (Solidity, Rust), and algorithmic trading systems.