isNameAvailableNoAuth function Null safety

Future<bool> isNameAvailableNoAuth(
  1. String name
)

Essentially the same as isNameAvailable, however this function does not require any authentication. It is not exactly accurate, however can be used to determine if a name was blocked by Mojang's name filter and/or the name is used on a empty Mojang account.

If a name is not valid, this will be false. This includes names shorter than 2 characters or longer than 16 characters or names that use invalid characters.

Implementation

Future<bool> isNameAvailableNoAuth(String name) async {
  final response =
      await request(http.get, _mojangAccountApi, 'available/minecraft/$name');
  if (response.statusCode != 200) return false;
  return response.body.trim() == 'AVAILABLE';
}