handleIdentificationResult static method
Handle identification result
Implementation
static void handleIdentificationResult(Map<dynamic, dynamic> payload) {
final ok = payload['ok'] as bool? ?? false;
if (ok) {
final result = IdentificationResult.fromMap(payload);
log('✅ Identification ${result.identified ? "SUCCESS" : "NOT FOUND"}');
if (result.identified) {
log(' CustomId: ${result.customId}');
log(' Confidence: ${result.confidence.toStringAsFixed(2)}');
log(' Distance: ${result.distance.toStringAsFixed(2)}');
}
resultStreamController?.add(result);
} else {
final error = payload['error'] as String? ?? 'Unknown error';
log('❌ Identification failed: $error');
errorStreamController?.add(error);
}
// Clean up for single-shot
closeStreams();
}