Skip to main content
Version: 0.7.1

News Categories

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

Parameters

ParameterTypeDescription
domainStringThe domain (region) code for retrieving news categories.
langDataLanguageThe language for news categories data (default: DataLanguage.id).

Example

Example usage and sample output:

Preview

// Fetch news categories data from BPS API
final result = await StadataFlutter.instance.list.newsCategories(domain: '7200');
final newsCategoryList = 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 category data
for (final newsCategory in newsCategoryList) {
print('News Category ID: ${newsCategory.id}');
print('News Category Name: ${newsCategory.name}');
}

Properties (NewsCategory)

PropertyTypeDescription
idStringThe unique identifier for the news category.
nameStringThe name for the news category.