convertToProtobufMap function

Map<String, Value>? convertToProtobufMap(
  1. Map? originalMap
)

Implementation

Map<String, Value>? convertToProtobufMap(Map<dynamic, dynamic>? originalMap) {
  Map<String, Value>? protobufMap = {};

  originalMap?.forEach((key, value) {
    if (key is String && value is String) {
      protobufMap[key] = Value()..stringValue = value;
    } else if (value is int) {
      protobufMap[key] = Value()..intValue = value;
    } else {
      throw ArgumentError('Unsupported value type: $value');
    }
  });

  return protobufMap;
}