getUser method

Future<UserResponse> getUser([
  1. String? jwt
])

Gets the current user details from current session or custom jwt

Implementation

Future<UserResponse> getUser([String? jwt]) async {
  if (jwt == null && currentSession?.accessToken == null) {
    throw AuthException('Cannot get user: no current session.');
  }
  final options = GotrueRequestOptions(
    headers: _headers,
    jwt: jwt ?? currentSession?.accessToken,
  );
  final response = await _fetch.request(
    '$_url/user',
    RequestMethodType.get,
    options: options,
  );
  return UserResponse.fromJson(response);
}