getValue<T> method
Implementation
T getValue<T>(String name, {T? defaultValue, bool allowEmpty = false}) {
final value = this[name] ?? defaultValue;
if (value is! T) {
throw ArgumentError.value(
value, null, 'Invalid value provided for $name');
}
if (value != null && value.toString().trim().isEmpty && !allowEmpty) {
throw ArgumentError.value(
value, null, 'Empty value not allowed for $name');
}
return value;
}