detectHuman method
Detect human in image at the given path.
Implementation
@override
Future<HumanDetectionResult> detectHuman(String imagePath) async {
try {
final result = await methodChannel.invokeMapMethod<dynamic, dynamic>(
'detectHuman',
{'imagePath': imagePath},
);
if (result == null) {
throw const HumanDetectionException(
'Detection returned null result',
code: HumanDetectionErrorCode.inferenceFailed,
);
}
return HumanDetectionResult.fromMap(result);
} on PlatformException catch (e) {
throw HumanDetectionException(
e.message ?? 'Failed to detect human',
code: e.code,
details: e.details,
);
}
}