-
Notifications
You must be signed in to change notification settings - Fork 6k
sync ui geometry.dart into web_ui geometry.dart; add null safety annotations #18356
Conversation
/// vertical component. | ||
const OffsetBase(double dx, double dy) | ||
: _dx = dx ?? 0.0, | ||
_dy = dy ?? 0.0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow -- this was for the STRAIGHT TO RELEASE MODE crowd I guess :)
lib/ui/geometry.dart
Outdated
|
||
@override | ||
String toString() => 'OffsetBase(${_dx?.toStringAsFixed(1)}, ${_dy?.toStringAsFixed(1)})'; | ||
String/*!*/ toString() => 'OffsetBase(${_dx?.toStringAsFixed(1)}, ${_dy?.toStringAsFixed(1)})'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we kill the ?
s here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
/// Creates an offset. The first argument sets [dx], the horizontal component, | ||
/// and the second sets [dy], the vertical component. | ||
const Offset(double dx, double dy) : super(dx, dy); | ||
const Offset(double/*!*/ dx, double/*!*/ dy) : super(dx, dy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionally, add non-null asserts for dx/dy here for (hopefully very limited-time) future proofing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The super
already does that (as of this PR).
lib/ui/geometry.dart
Outdated
|
||
@override | ||
String toString() => 'Offset(${dx?.toStringAsFixed(1)}, ${dy?.toStringAsFixed(1)})'; | ||
String/*!*/ toString() => 'Offset(${dx?.toStringAsFixed(1)}, ${dy?.toStringAsFixed(1)})'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kill the ?
s here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tool actually did it automatically! But removed anyway.
lib/ui/geometry.dart
Outdated
|
||
@override | ||
String toString() => 'Size(${width?.toStringAsFixed(1)}, ${height?.toStringAsFixed(1)})'; | ||
String/*!*/ toString() => 'Size(${width?.toStringAsFixed(1)}, ${height?.toStringAsFixed(1)})'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kill the ?
s here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
class Size extends OffsetBase { | ||
/// Creates a [Size] with the given [width] and [height]. | ||
const Size(double width, double height) : super(width, height); | ||
const Size(double/*!*/ width, double/*!*/ height) : super(width, height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again optionally add the asserts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: see the implementation of OffsetBase
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pending bots are infra flakiness. Merging. |
…tations (flutter#18356) sync ui geometry.dart into web_ui geometry.dart; add null safety
No description provided.