classifyFrame method
Runs one inference on a live camera frame, without writing it to disk.
Same contract as classify: throws CardGateException on any failure, and never reports a failure as CardGateLabel.other.
Implementation
@override
Future<CardGateResult> classifyFrame(CardGateFrame frame) async {
frame.validate();
try {
final payload = await methodChannel.invokeMapMethod<String, Object?>(
'classifyFrame',
frame.toMap(),
);
if (payload == null) {
throw const CardGateException(
CardGateException.codeFailed,
'Native classifyFrame returned no payload',
);
}
return CardGateResult.fromMap(payload);
} on PlatformException catch (error) {
throw _fromPlatform(error, 'Card Gate frame inference failed');
} on MissingPluginException catch (error) {
throw _missingPlugin(error);
}
}