insert method

void insert(
  1. Line line
)

Inserts a new Line into the paragraph.

Implementation

void insert(Line line) {
  if (_sealed) {
    throw StateError(
        'Element of type ${line.runtimeType} cannot be inserted when $runtimeType is sealed');
  }
  if (last != null && !last!.isSealed && last!.isEmpty && line.isNotEmpty) {
    for (final TextFragment frag in line.fragments) {
      _lines.last.addFragment(frag);
    }
    return;
  }
  _lines.add(line);
}