extractFace static method
Extracts the face/photo from a document image (Aadhaar, PAN, etc.) Uses native face detection (ML Kit on Android, Vision on iOS/macOS). Returns cropped face image bytes, or null if no face found.
Supported: Android, iOS, macOS. Windows/Linux: returns null (face detection not available).
Implementation
static Future<Uint8List?> extractFace(Uint8List imageBytes) async {
if (Platform.isWindows || Platform.isLinux) return null;
try {
final result = await _channel.invokeMethod<Uint8List>(
'extractFace',
{'imageBytes': imageBytes},
);
return result;
} on MissingPluginException {
return null;
} on PlatformException {
return null;
}
}