enroll static method
Future<void>
enroll({
- EnrollmentCallback? onComplete,
- EnrollmentProgressCallback? onProgress,
- EnrollmentFlowOptions? options,
Simplified single callback API for enrollment (similar to MAUI EnrollmentFlow.Run)
Presents the enrollment flow and calls the provided callback once with the result. User information (customId, groups, glasses) is collected through the native UI.
Parameters:
onComplete: Callback invoked when enrollment completes or failsonProgress: Optional callback for progress updates during enrollmentoptions: Optional enrollment settings (camera position, etc.)
Example:
await SmartfaceHostedFlow.enroll(
onComplete: ({
required bool success,
required String customId,
String? descriptor,
String? imagePath,
}) {
if (success) {
print('User enrolled: $customId');
if (descriptor != null) {
print('Descriptor: $descriptor');
}
} else {
print('Enrollment failed');
}
},
onProgress: ({String? phase, int? percentage, int? countdown}) {
print('Enrolling: $percentage% (phase: $phase)');
},
options: EnrollmentFlowOptions(
cameraPosition: SmartfaceCameraPosition.front,
),
);
Implementation
static Future<void> enroll({
EnrollmentCallback? onComplete,
EnrollmentProgressCallback? onProgress,
EnrollmentFlowOptions? options,
}) async {
return EnrollmentFlow.enroll(
onComplete: onComplete,
onProgress: onProgress,
options: options,
);
}