getNews function Null safety

Future<List<MinecraftNews>> getNews()

Returns a List of the most recent news for Minecraft.

This data can be found on the "News" page in the official Minecraft Launcher.

Implementation

Future<List<MinecraftNews>> getNews() async {
  final response =
      await request(http.get, _launcherContentApi, 'javaNews.json');
  final data = parseResponseMap(response);
  final news = <MinecraftNews>[];
  for (Map<String, dynamic> e in data['entries']) {
    news.add(MinecraftNews.fromJson(e));
  }
  return news;
}