asString method

String asString(
  1. String path, {
  2. String defaultValue = '',
})

returns the value at path as an String. If the value isn't an String then an exception will be thrown. If the key isn't a valid String then defaultValue is returned Use validString to determine if the key exists and is a valid String.

Implementation

String asString(String path, {String defaultValue = ''}) =>
    validString(path) ? valueMap[path] as String : defaultValue;