bool isOfEntityType(Object? o) { if (o == null) return false; return o is O || o.runtimeType == type; }