normalizeVariable function

VariableSchema? normalizeVariable(
  1. Map<String, dynamic> entry
)

Parses one raw entry from templateConfig.variables. Returns null when the entry lacks a valid name.

Implementation

VariableSchema? normalizeVariable(Map<String, dynamic> entry) {
  final name = entry['name'] as String?;
  if (name == null || name.isEmpty) return null;
  final type = entry['type'] == 'number' ? 'number' : 'string';
  final fallback = (entry['fallbackValue'] as String?) ??
      (entry['sampleValue'] as String?) ??
      '';
  return VariableSchema(name: name, type: type, fallbackValue: fallback);
}