textDecoration static method

TextDecoration textDecoration(
  1. DataSource source,
  2. List<Object> key
)

Returns a TextDecoration from the specified list or string.

If the key identifies a list, then each entry in the list is decoded by recursively invoking textDecoration, and the result is the combination of those TextDecoration values as obtained using TextDecoration.combine.

Otherwise, if the key identifies a string, then the value lineThrough is mapped to TextDecoration.lineThrough, overline to TextDecoration.overline, and underline to TextDecoration.underline. Other values (and the abscence of a value) are interpreted as TextDecoration.none.

Implementation

static TextDecoration textDecoration(DataSource source, List<Object> key) {
  final List<TextDecoration>? decorations = list<TextDecoration>(source, key, textDecoration);
  if (decorations != null) {
    return TextDecoration.combine(decorations);
  }
  switch (source.v<String>([...key])) {
    case 'lineThrough':
      return TextDecoration.lineThrough;
    case 'overline':
      return TextDecoration.overline;
    case 'underline':
      return TextDecoration.underline;
    default:
      return TextDecoration.none;
  }
}