getDetails method

Future<UserData?> getDetails()

Fetches the user profile details of the account.

Requests the account details that firebase itself has about the current account and returns them as UserData. If the request fails, an AuthError is thrown instead.

Note: If the request succeeds, but there is not user-data associated with the user, null is returned. In theory, this should never happen, but it is not guaranteed to never happen.

Implementation

Future<UserData?> getDetails() async {
  final response = await api.getUserData(UserDataRequest(idToken: _idToken));
  return response.users.isNotEmpty ? response.users.first : null;
}