Skip to main content
Version: 0.7.1

Subject Categories

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

Parameters

ParameterTypeDescription
domainStringThe domain (region) code for retrieving subject 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.subjectCategories(domain: '7200');
final subjectCategoryList = 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 subject category data
for (final subjectCategory in subjectCategoryList) {
print('Subject Category ID: ${subjectCategory.id}');
print('Subject Category Name: ${subjectCategory.name}');
}

Properties (SubjectCategory)

PropertyTypeDescription
idintThe unique identifier for the subject category.
nameStringThe name for the subject category.