Skip to main content
Version: 0.7.1

Domains

This method is used to retrieve a list of domains (regions) available in the BPS data.

Parameters

ParameterTypeDescription
typeDomainTypeThe type of domain to retrieve (default: DomainType.all).
provinceCodeString?The province code for filtering domains (required if type = DomainType.regencyByProvince).

Example

Example usage and sample output:

Preview

// Fetch domain data from BPS API
final domainResult = await StadataFlutter.instance.list.domains(
type: DomainType.all,
provinceCode: null, // Replace with the desired province code if needed
);

final domainList = domainResult.data;
final pagination = domainResult.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 domain data
for (final domain in domainList) {
print('Domain ID: ${domain.id}'); /// Ex. 7200
print('Name: ${domain.name}'); /// Sulawesi Tengah
print('URL: ${domain.url}'); /// https://sultengprov.bps.go.id
print('------------------------');
}

Properties (DomainEntity)

PropertyTypeDescription
nameStringThe name of the domain (region).
idStringUnique identifier for the domain.
urlStringURL associated with the domain.