classify method
Runs one inference on the photo at imagePath.
Throws CardGateException on any failure. Implementations must never report a failure as CardGateLabel.other.
Implementation
@override
Future<CardGateResult> classify(String imagePath) async {
try {
final payload = await methodChannel.invokeMapMethod<String, Object?>(
'classify',
<String, Object?>{'path': imagePath},
);
if (payload == null) {
throw const CardGateException(
CardGateException.codeFailed,
'Native classify returned no payload',
);
}
return CardGateResult.fromMap(payload);
} on PlatformException catch (error) {
throw _fromPlatform(error, 'Card Gate inference failed');
} on MissingPluginException catch (error) {
throw _missingPlugin(error);
}
}