processSummary function

void processSummary(
  1. Document document,
  2. SnapView view
)

Implementation

void processSummary(Document document, SnapView view) {
  if (view.summary != 'N/A') {
    return;
  }
  if (document.head != null) {
    final metas = document.head!.children
        .where((element) =>
            element.localName == 'meta' &&
            element.attributes['name'] == 'description')
        .toList();
    if (metas.isNotEmpty) {
      view.summary = metas.first.attributes['content']!;
    }
  }
}