h3ToChildren method
Get the children/descendents of the given h3Index
hexagon at a particular resolution
Implementation
@override
List<BigInt> h3ToChildren(BigInt h3Index, int resolution) {
// Bad input in this case can potentially result in high computation volume
// using the current C algorithm. Validate and return an empty array on failure.
if (!h3IsValid(h3Index)) {
return [];
}
final h3IndexInt = h3Index.toInt();
final maxSize = _h3c.maxH3ToChildrenSize(h3IndexInt, resolution);
return using((arena) {
final out = arena<Uint64>(maxSize);
_h3c.h3ToChildren(h3IndexInt, resolution, out);
final list = out.asTypedList(maxSize).toList();
return list.where((e) => e != 0).map((e) => e.toBigInt()).toList();
});
}