setStyle method Null safety

void setStyle(
  1. {required String? fontFamily,
  2. required double? fontSize,
  3. required FontWeight? fontWeight,
  4. required TextDirection textDirection,
  5. required TextAlign textAlign}
)

Send text styling information.

This information is used by the Flutter Web Engine to change the style of the hidden native input's content. Hence, the content size will match to the size of the editable widget's content.

Implementation

void setStyle({
  required String? fontFamily,
  required double? fontSize,
  required FontWeight? fontWeight,
  required TextDirection textDirection,
  required TextAlign textAlign,
}) {
  assert(attached);

  TextInput._instance._setStyle(
    <String, dynamic>{
      'fontFamily': fontFamily,
      'fontSize': fontSize,
      'fontWeightIndex': fontWeight?.index,
      'textAlignIndex': textAlign.index,
      'textDirectionIndex': textDirection.index,
    },
  );
}