hasPresence property
bool
get
hasPresence
Whether this field should have a hazzer
generated.
Implementation
bool get hasPresence {
// NB. Map fields are represented as repeated message fields
if (isRepeated) return false;
return true;
// TODO(sigurdm): to provide the correct semantics for non-optional proto3
// fields would need something like the following:
// return baseType.isMessage ||
// descriptor.proto3Optional ||
// parent.fileGen.descriptor.syntax == "proto2";
//
// This change would break any accidental uses of the proto3 hazzers, and
// would require some clean-up.
//
// We could consider keeping hazzers for proto3-oneof fields. There they
// seem useful and not breaking proto3 semantics, and dart protobuf uses it
// for example in package:protobuf/src/protobuf/mixins/well_known.dart.
}