propEach function
Iterates over properties in any geoJSON
object, calling callback
on each
iteration. Similar to Iterable.forEach
For example:
FeatureCollection featureCollection = FeatureCollection(
features: [
point1,
point2,
point3,
],
);
propEach(featureCollection, (currentProperties, featureIndex) {
someOperationOnEachProperty(currentProperties);
});
Implementation
void propEach(GeoJSONObject geoJSON, PropEachCallback callback) {
if (geoJSON is FeatureCollection) {
for (var i = 0; i < geoJSON.features.length; i++) {
if (callback(geoJSON.features[i].properties, i) == false) break;
}
} else if (geoJSON is Feature) {
callback(geoJSON.properties, 0);
} else {
throw Exception('Unknown Feature/FeatureCollection Type');
}
}