enrollFinishActivity method
Future<void>
enrollFinishActivity({
- required bool withGlasses,
- dynamic onPercentageChanged(
- dynamic
- dynamic onPushing(
- dynamic
- dynamic onCompleted(
- dynamic
- dynamic onFailed(
- dynamic
Completes the enrollment activity with the specified parameters.
This method registers callbacks for various stages of the enrollment
process and invokes the enrollFinishActivity
method on the platform
channel.
The withGlasses
parameter specifies whether the enrollment is done
with glasses.
The onPercentageChanged
callback is triggered when the enrollment
percentage changes.
The onPushing
callback is triggered during the pushing stage of the
enrollment.
The onCompleted
callback is triggered when the enrollment is completed
successfully.
The onFailed
callback is triggered if the enrollment fails.
All callbacks are optional and default to no-op functions if not provided.
Example usage:
await enrollFinishActivity(
withGlasses: true,
onPercentageChanged: (percentage) {
print('Enrollment percentage: $percentage');
},
onCompleted: () {
print('Enrollment completed successfully');
},
onFailed: (error) {
print('Enrollment failed with error: $error');
},
);
Implementation
Future<void> enrollFinishActivity({
required bool withGlasses,
Function(dynamic)? onPercentageChanged,
Function(dynamic)? onPushing,
Function(dynamic)? onCompleted,
Function(dynamic)? onFailed,
}) async {
registerCallback("onPercentageChanged", onPercentageChanged ?? (_) {});
//null/void
registerCallback("onPushing", onPushing ?? (_) {});
//startEnrollPrepareWithoutGlasses|enrollSuccess
registerCallback("onCompleted", onCompleted ?? (_) {});
//ErrorCodes
registerCallback("onFailed", onFailed ?? (_) {});
await methodChannel.invokeMethod('enrollFinishActivity', {
'withGlasses': withGlasses,
});
}