read<T> method

T? read<T>(
  1. String name
)

name is split using '.' and the map is traversed sequentially until the value is returned. Throws an ArgumentError if T does not match the value found.

If an integer is found, it will

Implementation

T? read<T>(String name) {
  final splitName = name.split('.');
  dynamic value = this;

  for (final subName in splitName) {
    value = _traverse(subName, value);
  }

  if (value == null) {
    return null;
  }

  if (value is! T) {
    throw ArgumentError('$value is not a $T!');
  }

  return value;
}