signOut method

Future<GotrueResponse> signOut()

Signs out the current user, if there is a logged in user.

Implementation

Future<GotrueResponse> signOut() async {
  final accessToken = currentSession?.accessToken;
  _removeSession();
  _notifyAllSubscribers(AuthChangeEvent.signedOut);
  if (accessToken != null) {
    final response = await api.signOut(accessToken);
    if (response.error != null) return response;
  }
  return const GotrueResponse();
}