insert method

void insert(
  1. Line line
)

Inserts a new Line into the paragraph.

line is the line to be inserted into the paragraph.

Throws an exception if the data type of line is not a string or a map.

Implementation

void insert(Line line) {
  if (line.data is String || line.data is Map) {
    lines.add(line);
    return;
  }
  throw Exception(
      'Invalid data type. Expected a String or Map for line data, but got ${line.data.runtimeType}.');
}