getNews static method
Implementation
static Future<Data> getNews(
{required NewsType newsType,
Language language = Language.en,
int limit = 10}) async {
final http.Response response = await http.get(Uri.parse(
getNewsEndPoint(newsType: newsType, language: language, limit: limit)));
GlobalResponse resp = GlobalResponse.fromJson(jsonDecode(response.body));
if (resp.error!) {
return Data(newsList: [], message: resp.message);
} else {
return Data(newsList: resp.data!.newsList!, message: 'Success');
}
}