doSerialization method

  1. @override
String doSerialization(
  1. Document document,
  2. HorizontalRuleNode node, {
  3. NodeSelection? selection,
})
override

Implementation

@override
String doSerialization(
  Document document,
  HorizontalRuleNode node, {
  NodeSelection? selection,
}) {
  if (selection != null) {
    if (selection is! UpstreamDownstreamNodeSelection) {
      // We don't know how to handle this selection type.
      return '';
    }
    if (selection.isCollapsed) {
      // This selection doesn't include the horizontal rule - it's a collapsed selection
      // either on the upstream or downstream edge.
      return '';
    }
  }

  return '---';
}