maxLines property Null safety

int maxLines
override

An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow.

If this is 1, text will not wrap. Otherwise, text will be wrapped at the edge of the box.

If this is null, but there is an ambient DefaultTextStyle that specifies an explicit number for its DefaultTextStyle.maxLines, then the DefaultTextStyle value will take precedence. You can use a RichText widget directly to entirely override the DefaultTextStyle.

Implementation

@override
int get maxLines => 1;