hasComparator property
bool
get
hasComparator
Whether this controller sorts siblings with a comparator.
Exists because reading comparator itself through a covariantly-typed
reference (TreeController<TKey, Object?>, how TreeReorderController
holds its controller) throws a runtime TypeError whenever a
comparator is actually set: the comparator's function type uses
TData contravariantly, so a non-null value fails the implicit
covariance check on the read. (A null comparator reads fine, null
inhabits every nullable type, which makes the failure mode
data-dependent and easy to miss.) A bool carries no TData and is
safe from any reference type.
Implementation
bool get hasComparator {
return comparator != null;
}