getRequiredPropertyAs<T> method

  1. @override
T getRequiredPropertyAs<T>(
  1. String key,
  2. Class<T> valueType
)
override

Retrieves and converts the property key to type T, or throws IllegalStateException if missing or invalid.

targetType - the expected type of the property value key - the property key

Example:

final timeout = resolver.getRequiredPropertyAs<int>('http.timeout');

Implementation

@override
T getRequiredPropertyAs<T>(String key, Class<T> valueType) {
		T? value = getPropertyAs<T>(key, valueType);
		if (value == null) {
			throw IllegalStateException("Required key '$key' not found");
		}
		return value;
	}