Skip to content

Commit e2c4b27

Browse files
Use Dart 2 camel case constants in the engine Dart libraries (#4766)
1 parent 9c1e484 commit e2c4b27

5 files changed

Lines changed: 20 additions & 20 deletions

File tree

‎lib/ui/geometry.dart‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ abstract class OffsetBase {
1717
final double _dx;
1818
final double _dy;
1919

20-
/// Returns true if either component is [double.INFINITY], and false if both
20+
/// Returns true if either component is [double.infinity], and false if both
2121
/// are finite (or negative infinity, or NaN).
2222
///
2323
/// This is different than comparing for equality with an instance that has
24-
/// _both_ components set to [double.INFINITY].
24+
/// _both_ components set to [double.infinity].
2525
///
2626
/// See also:
2727
///
2828
/// * [isFinite], which is true if both components are finite (and not NaN).
29-
bool get isInfinite => _dx >= double.INFINITY || _dy >= double.INFINITY;
29+
bool get isInfinite => _dx >= double.infinity || _dy >= double.infinity;
3030

3131
/// Whether both components are finite (neither infinite nor NaN).
3232
///
@@ -183,7 +183,7 @@ class Offset extends OffsetBase {
183183
/// * [isInfinite], which checks whether either component is infinite.
184184
/// * [isFinite], which checks whether both components are finite.
185185
// This is included for completeness, because [Size.infinite] exists.
186-
static const Offset infinite = const Offset(double.INFINITY, double.INFINITY);
186+
static const Offset infinite = const Offset(double.infinity, double.infinity);
187187

188188
/// Returns a new offset with the x component scaled by `scaleX` and the y
189189
/// component scaled by `scaleY`.
@@ -352,10 +352,10 @@ class Size extends OffsetBase {
352352
const Size.square(double dimension) : super(dimension, dimension);
353353

354354
/// Creates a [Size] with the given [width] and an infinite [height].
355-
const Size.fromWidth(double width) : super(width, double.INFINITY);
355+
const Size.fromWidth(double width) : super(width, double.infinity);
356356

357357
/// Creates a [Size] with the given [height] and an infinite [width].
358-
const Size.fromHeight(double height) : super(double.INFINITY, height);
358+
const Size.fromHeight(double height) : super(double.infinity, height);
359359

360360
/// Creates a square [Size] whose [width] and [height] are twice the given
361361
/// dimension.
@@ -382,7 +382,7 @@ class Size extends OffsetBase {
382382
///
383383
/// * [isInfinite], which checks whether either dimension is infinite.
384384
/// * [isFinite], which checks whether both dimensions are finite.
385-
static const Size infinite = const Size(double.INFINITY, double.INFINITY);
385+
static const Size infinite = const Size(double.infinity, double.infinity);
386386

387387
/// Whether this size encloses a non-zero area.
388388
///
@@ -670,10 +670,10 @@ class Rect {
670670
/// Whether any of the coordinates of this rectangle are equal to positive infinity.
671671
// included for consistency with Offset and Size
672672
bool get isInfinite {
673-
return left >= double.INFINITY
674-
|| top >= double.INFINITY
675-
|| right >= double.INFINITY
676-
|| bottom >= double.INFINITY;
673+
return left >= double.infinity
674+
|| top >= double.infinity
675+
|| right >= double.infinity
676+
|| bottom >= double.infinity;
677677
}
678678

679679
/// Whether all coordinates of this rectangle are finite.

‎lib/ui/hooks.dart‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
part of dart.ui;
66

77
String _decodeUTF8(ByteData message) {
8-
return message != null ? UTF8.decoder.convert(message.buffer.asUint8List()) : null;
8+
return message != null ? utf8.decoder.convert(message.buffer.asUint8List()) : null;
99
}
1010

1111
dynamic _decodeJSON(String message) {
12-
return message != null ? JSON.decode(message) : null;
12+
return message != null ? json.decode(message) : null;
1313
}
1414

1515
void _updateWindowMetrics(double devicePixelRatio,
@@ -50,8 +50,8 @@ void _updateLocale(String languageCode, String countryCode) {
5050
_invoke(window.onLocaleChanged, window._onLocaleChangedZone);
5151
}
5252

53-
void _updateUserSettingsData(String json) {
54-
final Map<String, dynamic> data = JSON.decode(json);
53+
void _updateUserSettingsData(String jsonData) {
54+
final Map<String, dynamic> data = json.decode(jsonData);
5555
_updateTextScaleFactor(data['textScaleFactor'].toDouble());
5656
_updateAlwaysUse24HourFormat(data['alwaysUse24HourFormat']);
5757
}
@@ -174,7 +174,7 @@ void _invoke3<A1, A2, A3>(void callback(A1 a1, A2 a2, A3 a3), Zone zone, A1 arg1
174174
const int _kPointerDataFieldCount = 19;
175175

176176
PointerDataPacket _unpackPointerDataPacket(ByteData packet) {
177-
const int kStride = Int64List.BYTES_PER_ELEMENT;
177+
const int kStride = Int64List.bytesPerElement;
178178
const int kBytesPerPointerData = _kPointerDataFieldCount * kStride;
179179
final int length = packet.lengthInBytes ~/ kBytesPerPointerData;
180180
assert(length * kBytesPerPointerData == packet.lengthInBytes);

‎lib/ui/natives.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Future<developer.ServiceExtensionResponse> _scheduleFrame(
2222
// Schedule the frame.
2323
window.scheduleFrame();
2424
// Always succeed.
25-
return new developer.ServiceExtensionResponse.result(JSON.encode(<String, String>{
25+
return new developer.ServiceExtensionResponse.result(json.encode(<String, String>{
2626
'type': 'Success',
2727
}));
2828
}

‎lib/ui/painting.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,9 +838,9 @@ enum PaintingStyle {
838838
}
839839

840840
// If we actually run on big endian machines, we'll need to do something smarter
841-
// here. We don't use [Endianness.HOST_ENDIAN] because it's not a compile-time
841+
// here. We don't use [Endian.Host] because it's not a compile-time
842842
// constant and can't propagate into the set/get calls.
843-
const Endianness _kFakeHostEndian = Endianness.LITTLE_ENDIAN;
843+
const Endian _kFakeHostEndian = Endian.little;
844844

845845
/// A description of the style to use when drawing on a [Canvas].
846846
///

‎lib/ui/pointer.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ enum PointerDeviceKind {
5555
class PointerData {
5656
/// Creates an object that represents the state of a pointer.
5757
const PointerData({
58-
this.timeStamp: Duration.ZERO,
58+
this.timeStamp: Duration.zero,
5959
this.change: PointerChange.cancel,
6060
this.kind: PointerDeviceKind.touch,
6161
this.device: 0,

0 commit comments

Comments
 (0)