getNameHistory function Null safety

Future<List<Name>> getNameHistory(
  1. String uuid
)

Returns the name history for the account with uuid.

Implementation

Future<List<Name>> getNameHistory(String uuid) async {
  final response =
      await request(http.get, _mojangApi, 'user/profiles/$uuid/names');
  if (response.statusCode == 204 ||
      response.statusCode == 400 ||
      response.statusCode == 404) {
    throw ArgumentError.value(
        uuid, 'uuid', 'User for given UUID could not be found or is invalid.');
  }
  final list = parseResponseList(response);
  return Future.value(list.map((dynamic v) => Name.fromJson(v)).toList());
}