updateConsent method
Future<void>
updateConsent(
- bool givesConsent,
- WidgetRef ref
)
Implementation
Future<void> updateConsent(bool givesConsent, WidgetRef ref) async {
state = state.copyWith(isLoading: true, error: null);
try {
final request = ConsentRequest(givesConsent: givesConsent);
await ApiClient.shared.perform(request);
if (givesConsent) {
ref.read(verificationStateProvider.notifier).allowNavigation();
} else {
ref.read(verificationStateProvider.notifier).cancelVerification();
}
state = state.copyWith(isLoading: false);
} catch (e) {
state = state.copyWith(
isLoading: false,
error: e.toString(),
);
ref.read(verificationStateProvider.notifier).reportError(e.toString());
}
}