getRequiredValueFromMap<T> static method
Helper method to get a required value from a map that may contain either camelCase or snake_case keys. Throws a FormatException if the key is not found.
Implementation
static T getRequiredValueFromMap<T>(
Map<String, dynamic> map,
String camelCaseKey,
String snakeCaseKey,
) {
final value = map[camelCaseKey] ?? map[snakeCaseKey];
if (value == null) {
throw FormatException('Required field "$camelCaseKey" is missing from map');
}
return value as T;
}