read<T> method

T? read<T>(
  1. String path,
  2. T? parse(
    1. String value
    ),
  3. String expected
)

The value at path parsed with parse; null when there is none. Throws a ThemePropertyException naming the property and expected when parse cannot read it.

Implementation

T? read<T>(String path, T? Function(String value) parse, String expected) {
  final value = this[path];
  if (value == null) {
    return null;
  }
  return parse(value) ??
      (throw ThemePropertyException(propertyName(path), value, expected));
}