resolveFeatures function

Map<String, String> resolveFeatures(
  1. String edition,
  2. Map<String, Object?>? fileFeatures,
  3. Map<String, Object?>? messageFeatures,
  4. Map<String, Object?>? fieldFeatures,
)

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);
}