SystemLocationDataSource constructor
Creates a system location data source.
The interval
is the interval in milliseconds at which location updates are requested.
The distanceFilter
is the distance filter in meters at which location updates are requested.
Implementation
factory SystemLocationDataSource({
int interval = 250,
double distanceFilter = 0.0,
}) {
if (interval <= 0) {
throw ArgumentError.value(
interval,
'interval',
'The interval must be greater than 0.',
);
}
if (distanceFilter < 0) {
throw ArgumentError.value(
distanceFilter,
'distanceFilter',
'The distance filter must be greater than or equal to 0.',
);
}
final handle = _withThrowingErrorHandler((errorHandler) {
return runtimecore.RT_LocationDataSource_create(errorHandler);
});
// Create the SystemLocationDataSource and add it to the LocationDataSource instance cache.
final systemLds = SystemLocationDataSource._withHandle(handle);
LocationDataSource._instanceCache.addInstance(systemLds);
systemLds._interval = interval;
systemLds._distanceFilter = distanceFilter;
return systemLds;
}