enrollFinishWithoutPushingActivity method

Future<void> enrollFinishWithoutPushingActivity({
  1. required bool withGlasses,
  2. dynamic onPercentageChanged(
    1. dynamic
    )?,
  3. dynamic onCompleted(
    1. Map<String, dynamic>
    )?,
  4. dynamic onFailed(
    1. dynamic
    )?,
})

Completes the enrollment process without pushing the activity to the server.

This method registers callbacks for various stages of the enrollment process and invokes the enrollFinishActivity method on the platform's method channel.

Parameters:

  • withGlasses (required): A boolean indicating whether the user is wearing glasses.
  • onPercentageChanged (optional): A callback function that is triggered when the enrollment percentage changes.
  • onCompleted (optional): A callback function that is triggered when the enrollment process is completed. The function receives a Map<String, dynamic> containing the completion arguments.
  • onFailed (optional): A callback function that is triggered when the enrollment process fails.

Implementation

Future<void> enrollFinishWithoutPushingActivity({
  required bool withGlasses,
  Function(dynamic)? onPercentageChanged,
  Function(Map<String, dynamic>)? onCompleted,
  Function(dynamic)? onFailed,
}) async {
  registerCallback("onPercentageChanged", onPercentageChanged ?? (_) {});

  registerCallback("onCompleted", (arguments) {
    if (onCompleted != null) {
      final Map<String, dynamic> args = jsonDecode(arguments);
      onCompleted(args);
    }
  });

  registerCallback("onFailed", onFailed ?? (_) {});

  await methodChannel.invokeMethod('enrollFinishActivity', {
    'withGlasses': withGlasses,
    'withoutServerPushing': true,
  });
}