decode static method

NapaText? decode(
  1. dynamic data
)
override

Deserialize a json compatible object into a NapaWidget or null.

Implementation

static NapaText? decode(dynamic data) {
  if (data == null) {
    return null;
  }

  return NapaText(
    data['text'],
    style: NapaTextStyle.decode(data['style']),
    strutStyle: decodeStrutStyle(data['strutStyle']),
    textAlign: decodeTextAlign(data['textAlign']),
    textDirection: decodeTextDirection(data['textDirection']),
    locale: decodeLocale(data['locale']),
    softWrap: data['softWrap'],
    overflow: decodeTextOverflow(data['overflow']),
    textScaler: NapaTextScaler.decode(data['textScaler']),
    maxLines: data['maxLines'],
    semanticsLabel: data['semanticsLabel'],
    semanticsIdentifier: data['semanticsIdentifier'],
    textWidthBasis: decodeTextWidthBasis(data['textWidthBasis']),
    textHeightBehavior: decodeTextHeightBehavior(data['textHeightBehavior']),
    selectionColor: decodeColor(data['selectionColor'])
  );
}