-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
a: typographyText rendering, possibly libtxtText rendering, possibly libtxtd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework team
Description
The getFullHeightForCaret declared in RenderParagraph and TextPainter has a return type of double?, but looking at the implementation it seems it couldn't possibly return null:
flutter/packages/flutter/lib/src/rendering/paragraph.dart
Lines 952 to 959 in 274152f
| /// {@macro flutter.painting.textPainter.getFullHeightForCaret} | |
| /// | |
| /// Valid only after [layout]. | |
| double? getFullHeightForCaret(TextPosition position) { | |
| assert(!debugNeedsLayout); | |
| _layoutTextWithConstraints(constraints); | |
| return _textPainter.getFullHeightForCaret(position, Rect.zero); | |
| } |
flutter/packages/flutter/lib/src/painting/text_painter.dart
Lines 1350 to 1358 in 274152f
| /// {@template flutter.painting.textPainter.getFullHeightForCaret} | |
| /// Returns the strut bounded height of the glyph at the given `position`. | |
| /// {@endtemplate} | |
| /// | |
| /// Valid only after [layout] has been called. | |
| double? getFullHeightForCaret(TextPosition position, Rect caretPrototype) { | |
| final TextBox textBox = _getOrCreateLayoutTemplate().getBoxesForRange(0, 1, boxHeightStyle: ui.BoxHeightStyle.strut).single; | |
| return textBox.toRect().height; | |
| } |
If the return type must be nullable, then it should be documented why. Otherwise, the return type should be changed to double.
Metadata
Metadata
Assignees
Labels
a: typographyText rendering, possibly libtxtText rendering, possibly libtxtd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework team