newCell static method

Cell newCell(
  1. WidthMethod method,
  2. String grapheme
)

Creates a new cell from a grapheme, computing its display width.

Implementation

static Cell newCell(WidthMethod method, String grapheme) {
  if (grapheme.isEmpty) return Cell();
  if (grapheme == ' ') return Cell.emptyCell();
  return Cell(content: grapheme, width: method.stringWidth(grapheme));
}