logout method

Future<void> logout(
  1. dynamic context
)

Implementation

Future<void> logout(BuildContext context) async {
  final sdk = await ref.read(sdkProvider.future);
  final stillHasClient = await sdk.logout();
  if (stillHasClient) {
    _log.info('Still has clients, dropping back to other');
    ref.read(clientProvider.notifier).state = sdk.currentClient;
    if (context.mounted) {
      context.goNamed(Routes.main.name);
    }
  } else {
    _log.warning('No clients left, redir to onboarding');
    if (context.mounted) {
      context.goNamed(Routes.main.name);
    }
  }
}