Skip to main content
Version: latest

News

This method is used to retrieve a list of news based on the selected domain (region).

Parameters

ParameterTypeDescription
domainStringThe domain (region) code for retrieving news.
langDataLanguageThe language for news data (default: DataLanguage.id).
pageintThe page number (default: 1).
keywordString?A keyword for searching news (optional).
newsCategoryIdString?The category for filtering news (optional).
monthint?The month for filtering news (optional - 1..12).
yearint?The year for filtering news (optional).

Example

Example usage and sample output:

Preview

// Fetch news from BPS API
final result = await StadataFlutter.instance.list.news(domain: '7200');
final newsList = result.data;
final pagination = result.pagination;


// Print pagination info
print('Current Page: ${pagination.page}');
print('Total Pages: ${pagination.pages}');
print('Data Count in This Page: ${pagination.count}');
print('Per Page: ${pagination.perPage}');
print('Total: ${pagination.total}');
print('------------------------');

// Print the retrieved news data
for (final news in newsList) {
print('News ID: ${news.id}');
print('Category: ${news.category}');
print('Title: ${news.title}');
print('Content: ${news.content}');
print('Release Date: ${news.releaseDate}');
print('Picture: ${news.picture}');
print('------------------------');
}

Properties (News)

PropertyTypeDescription
idintThe unique identifier for the news.
categoryIdStringThe category identifier for the news (optional).
categoryString?The name of the news category (optional).
titleStringThe title of the news.
contentStringThe content of the news.
releaseDateDateTimeThe date when the news was released.
pictureStringThe picture associated with the news.