getElementForSample method

SourceElement? getElementForSample(
  1. CodeSample sample
)

Find the element that owns a particular sample.

Implementation

SourceElement? getElementForSample(CodeSample sample) {
  if (elements == null) {
    return null;
  }
  return elements!.where((SourceElement element) => element.samples.contains(sample)).single;
}