getCount method
Parses the shpfile counting the records.
@return the number of non-null records in the shapefile
Implementation
Future<int> getCount(int count) async {
try {
if (channel == null) return -1;
count = 0;
int offset = currentOffset;
try {
await goTo(100);
} catch (e) {
return -1;
}
while (await hasNext()) {
count++;
await nextRecord();
}
await goTo(offset);
} catch (ioe) {
count = -1;
// What now? This seems arbitrarily appropriate !
throw ArgumentError("Problem reading shapefile record: $ioe");
}
return count;
}