pathFieldTopLevelNames property
All field names referenced by path variables, flattened (top-level name only, e.g. "user" for "user.address.city") — used to know which top-level fields must NOT be treated as query params even when the nested value used in the path is a child of them.
Implementation
Set<String> get pathFieldTopLevelNames =>
segments
.where((s) => s.isVariable)
.map((s) => s.fieldPath!.split('.').first)
.toSet();