completeRegistration method
OTP completion is explicit and carries only an opaque challenge ID.
Implementation
Future<bool> completeRegistration({required String challengeId}) async {
final config = _config;
if (config == null ||
!config.enabled ||
!config.completeRegistrationEnabled ||
challengeId.trim().isEmpty ||
_completedChallenges.contains(challengeId)) {
return false;
}
_completedChallenges.add(challengeId);
try {
final delivered =
await _channel.invokeMethod<bool>('logEvent', {
'event': 'CompleteRegistration',
'parameters': {'registration_method': 'phone_otp'},
}) ??
false;
if (!delivered) _completedChallenges.remove(challengeId);
return delivered;
} catch (_) {
_completedChallenges.remove(challengeId);
rethrow;
}
}