resolveFeatures function
Back-compat convenience wrapper: resolves features down the common file → message → field chain for an edition/syntax string.
edition accepts "proto2", "proto3", "2023", "2024" (or the
EDITION_* forms). Each override map may carry any subset of the feature
keys; only present keys override the inherited value.
Implementation
Map<String, String> resolveFeatures(
String edition,
Map<String, Object?>? fileFeatures,
Map<String, Object?>? messageFeatures,
Map<String, Object?>? fieldFeatures,
) {
final ed = editionFromString(edition);
if (ed == editionUnknown) {
throw ArgumentError('Unrecognized protobuf edition: "$edition"');
}
final file = resolveFileFeatures(ed, fileFeatures);
final message = mergeChildFeatures(ed, file, messageFeatures);
return mergeChildFeatures(ed, message, fieldFeatures);
}