asListOfString method

List<String>? asListOfString(
  1. String key, {
  2. bool throwOnNull = true,
})

Implementation

List<String>? asListOfString(String key, {bool throwOnNull = true}) {
  final List? value = as(key);
  if (value == null) {
    if (!throwOnNull) {
      return null;
    }
    throw DartSuiPluginException('Key not found.',
        details: {'key': key, 'data': this});
  }
  try {
    return value.cast<String>();
  } catch (e, s) {
    throw DartSuiPluginException('Incorrect value.', details: {
      'key': key,
      'value': value.runtimeType,
      'data': this,
      'error': e.toString(),
      'stack': s.toString()
    });
  }
}