setGuestUser method

Future<void> setGuestUser (
  1. User user
)

Set the current user as guest, this triggers a connection to the API. It returns a Future that resolves when the connection is setup.

Implementation

Future<void> setGuestUser(User user) async {
  _anonymous = true;
  final response = await post('/guest', data: {'user': user.toJson()})
      .then((res) => decode<SetGuestUserResponse>(
          res.data, SetGuestUserResponse.fromJson))
      .whenComplete(() => _anonymous = false);
  return setUser(
    response.user,
    response.accessToken,
  );
}