extract_content method

dynamic extract_content(
  1. dynamic source
)

Implementation

extract_content(dynamic source) {
  // ignore: prefer_typing_uninitialized_variables
  var result;
  try {
    if (ds_num == null) {
      result = nested_lookup(source, data_map);
    } else {
      result = nested_lookup(source['ds:$ds_num'], data_map);
    }

    if (post_processor != null) {
      result = post_processor!(result);
    }
  } catch (_) {
    if (fallback_value is ElementSpec) {
      result = fallback_value.extract_content(source);
    } else {
      result = fallback_value;
    }
  }
  return result;
}