run method

  1. @override
Future<void> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<void> run() async {
  AuthStatus isUserLoggedIn = await Auth.isAuthenticated;

  if (isUserLoggedIn == AuthStatus.notAuthenticated) {
    wtLog.info('You are not logged in');
    return;
  }

  wtLog.startSpinner('Logging out...', severity: MessageSeverity.info);
  bool loggedOut = Auth.logout();
  loggedOut
      ? wtLog.stopSpinner(
          message: '✅ Logged out successfully.',
          severity: MessageSeverity.success)
      : wtLog.stopSpinner(
          message: '❌ Error logging out.', severity: MessageSeverity.error);
}