diff --git a/examples/flutter_gallery/lib/demo/animation/home.dart b/examples/flutter_gallery/lib/demo/animation/home.dart index f660a2a959..73b416327b 100644 --- a/examples/flutter_gallery/lib/demo/animation/home.dart +++ b/examples/flutter_gallery/lib/demo/animation/home.dart @@ -398,7 +398,7 @@ class _SnappingScrollPhysics extends ClampingScrollPhysics { // If the simulation is headed up towards midScrollOffset but will not reach it, // then snap it there. Similarly if the simulation is headed down past // midScrollOffset but will not reach zero, then snap it to zero. - final double simulationEnd = simulation.x(double.INFINITY); + final double simulationEnd = simulation.x(double.infinity); if (simulationEnd >= midScrollOffset) return simulation; if (dragVelocity > 0.0) diff --git a/examples/layers/raw/canvas.dart b/examples/layers/raw/canvas.dart index 55464dc27e..6173a4ce1e 100644 --- a/examples/layers/raw/canvas.dart +++ b/examples/layers/raw/canvas.dart @@ -38,7 +38,7 @@ ui.Picture paint(ui.Rect paintBounds) { canvas.translate(mid.dx, mid.dy); paint.color = const ui.Color.fromARGB(128, 255, 0, 255); - canvas.rotate(math.PI/4.0); + canvas.rotate(math.pi/4.0); final ui.Gradient yellowBlue = new ui.Gradient.linear( new ui.Offset(-radius, -radius), diff --git a/examples/layers/raw/spinning_square.dart b/examples/layers/raw/spinning_square.dart index 79cb498567..1bc64c6066 100644 --- a/examples/layers/raw/spinning_square.dart +++ b/examples/layers/raw/spinning_square.dart @@ -26,8 +26,8 @@ void beginFrame(Duration timeStamp) { // Here we determine the rotation according to the timeStamp given to us by // the engine. - final double t = timeStamp.inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND / 1800.0; - canvas.rotate(math.PI * (t % 1.0)); + final double t = timeStamp.inMicroseconds / Duration.microsecondsPerMillisecond / 1800.0; + canvas.rotate(math.pi * (t % 1.0)); canvas.drawRect(new ui.Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0), new ui.Paint()..color = const ui.Color.fromARGB(255, 0, 255, 0)); diff --git a/examples/layers/rendering/spinning_square.dart b/examples/layers/rendering/spinning_square.dart index f52a899e90..7f0b125b5a 100644 --- a/examples/layers/rendering/spinning_square.dart +++ b/examples/layers/rendering/spinning_square.dart @@ -52,9 +52,9 @@ void main() { vsync: const NonStopVSync(), )..repeat(); // The animation will produce a value between 0.0 and 1.0 each frame, but we - // want to rotate the square using a value between 0.0 and math.PI. To change + // want to rotate the square using a value between 0.0 and math.pi. To change // the range of the animation, we use a Tween. - final Tween tween = new Tween(begin: 0.0, end: math.PI); + final Tween tween = new Tween(begin: 0.0, end: math.pi); // We add a listener to the animation, which will be called every time the // animation ticks. animation.addListener(() { diff --git a/examples/layers/rendering/src/sector_layout.dart b/examples/layers/rendering/src/sector_layout.dart index 2745648408..593aa80918 100644 --- a/examples/layers/rendering/src/sector_layout.dart +++ b/examples/layers/rendering/src/sector_layout.dart @@ -7,12 +7,12 @@ import 'dart:math' as math; import 'package:flutter/rendering.dart'; import 'package:flutter/gestures.dart'; -const double kTwoPi = 2 * math.PI; +const double kTwoPi = 2 * math.pi; class SectorConstraints extends Constraints { const SectorConstraints({ this.minDeltaRadius: 0.0, - this.maxDeltaRadius: double.INFINITY, + this.maxDeltaRadius: double.infinity, this.minDeltaTheta: 0.0, this.maxDeltaTheta: kTwoPi }) : assert(maxDeltaRadius >= minDeltaRadius), @@ -99,9 +99,9 @@ abstract class RenderSector extends RenderObject { void debugAssertDoesMeetConstraints() { assert(constraints != null); assert(deltaRadius != null); - assert(deltaRadius < double.INFINITY); + assert(deltaRadius < double.infinity); assert(deltaTheta != null); - assert(deltaTheta < double.INFINITY); + assert(deltaTheta < double.infinity); assert(constraints.minDeltaRadius <= deltaRadius); assert(deltaRadius <= math.max(constraints.minDeltaRadius, constraints.maxDeltaRadius)); assert(constraints.minDeltaTheta <= deltaTheta); @@ -215,7 +215,7 @@ class RenderSectorRing extends RenderSectorWithChildren { RenderSectorRing({ BoxDecoration decoration, - double deltaRadius: double.INFINITY, + double deltaRadius: double.infinity, double padding: 0.0 }) : _padding = padding, assert(deltaRadius >= 0.0), @@ -284,7 +284,7 @@ class RenderSectorRing extends RenderSectorWithChildren { void performLayout() { assert(parentData is SectorParentData); deltaRadius = constraints.constrainDeltaRadius(desiredDeltaRadius); - assert(deltaRadius < double.INFINITY); + assert(deltaRadius < double.infinity); final double innerDeltaRadius = deltaRadius - padding * 2.0; final double childRadius = parentData.radius + padding; final double paddingTheta = math.atan(padding / (parentData.radius + deltaRadius)); @@ -487,8 +487,8 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil } Size getIntrinsicDimensions({ - double width: double.INFINITY, - double height: double.INFINITY + double width: double.infinity, + double height: double.infinity }) { assert(child is RenderSector); assert(child.parentData is SectorParentData); @@ -539,7 +539,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil y -= size.height / 2.0; // convert to radius/theta final double radius = math.sqrt(x * x + y * y); - final double theta = (math.atan2(x, -y) - math.PI / 2.0) % kTwoPi; + final double theta = (math.atan2(x, -y) - math.pi / 2.0) % kTwoPi; if (radius < innerRadius) return false; if (radius >= innerRadius + child.deltaRadius) @@ -555,7 +555,7 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil class RenderSolidColor extends RenderDecoratedSector { RenderSolidColor(this.backgroundColor, { - this.desiredDeltaRadius: double.INFINITY, + this.desiredDeltaRadius: double.infinity, this.desiredDeltaTheta: kTwoPi }) : super(new BoxDecoration(color: backgroundColor)); diff --git a/examples/layers/rendering/src/solid_color_box.dart b/examples/layers/rendering/src/solid_color_box.dart index 5ea81e3ba5..073e298393 100644 --- a/examples/layers/rendering/src/solid_color_box.dart +++ b/examples/layers/rendering/src/solid_color_box.dart @@ -14,22 +14,22 @@ class RenderSolidColorBox extends RenderDecoratedBox { @override double computeMinIntrinsicWidth(double height) { - return desiredSize.width == double.INFINITY ? 0.0 : desiredSize.width; + return desiredSize.width == double.infinity ? 0.0 : desiredSize.width; } @override double computeMaxIntrinsicWidth(double height) { - return desiredSize.width == double.INFINITY ? 0.0 : desiredSize.width; + return desiredSize.width == double.infinity ? 0.0 : desiredSize.width; } @override double computeMinIntrinsicHeight(double width) { - return desiredSize.height == double.INFINITY ? 0.0 : desiredSize.height; + return desiredSize.height == double.infinity ? 0.0 : desiredSize.height; } @override double computeMaxIntrinsicHeight(double width) { - return desiredSize.height == double.INFINITY ? 0.0 : desiredSize.height; + return desiredSize.height == double.infinity ? 0.0 : desiredSize.height; } @override diff --git a/examples/layers/services/isolate.dart b/examples/layers/services/isolate.dart index e6d53b0fd4..2efae63a14 100644 --- a/examples/layers/services/isolate.dart +++ b/examples/layers/services/isolate.dart @@ -120,7 +120,7 @@ class CalculationManager { if (isRunning) { _state = CalculationState.idle; if (_isolate != null) { - _isolate.kill(priority: Isolate.IMMEDIATE); + _isolate.kill(priority: Isolate.immediate); _isolate = null; _completed = 0.0; _total = 1.0; @@ -144,7 +144,7 @@ class CalculationManager { // is synchronous, so if done in the main isolate, the UI would block. Isolate.spawn(_calculate, message).then((Isolate isolate) { if (!isRunning) { - isolate.kill(priority: Isolate.IMMEDIATE); + isolate.kill(priority: Isolate.immediate); } else { _state = CalculationState.calculating; _isolate = isolate; diff --git a/examples/layers/widgets/sectors.dart b/examples/layers/widgets/sectors.dart index c978218edf..85e7de4752 100644 --- a/examples/layers/widgets/sectors.dart +++ b/examples/layers/widgets/sectors.dart @@ -34,10 +34,10 @@ class SectorAppState extends State { final double currentTheta = this.currentTheta; if (currentTheta < kTwoPi) { double deltaTheta; - if (currentTheta >= kTwoPi - (math.PI * 0.2 + 0.05)) + if (currentTheta >= kTwoPi - (math.pi * 0.2 + 0.05)) deltaTheta = kTwoPi - currentTheta; else - deltaTheta = math.PI * rand.nextDouble() / 5.0 + 0.05; + deltaTheta = math.pi * rand.nextDouble() / 5.0 + 0.05; wantedSectorSizes.add(deltaTheta); updateEnabledState(); } diff --git a/examples/layers/widgets/spinning_mixed.dart b/examples/layers/widgets/spinning_mixed.dart index adfbd79017..62b52189c5 100644 --- a/examples/layers/widgets/spinning_mixed.dart +++ b/examples/layers/widgets/spinning_mixed.dart @@ -82,7 +82,7 @@ RenderTransform transformBox; void rotate(Duration timeStamp) { timeBase ??= timeStamp; - final double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; // radians + final double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.microsecondsPerSecond; // radians transformBox.setIdentity(); transformBox.rotateZ(delta); diff --git a/examples/layers/widgets/spinning_square.dart b/examples/layers/widgets/spinning_square.dart index be59f1cd61..81312d6109 100644 --- a/examples/layers/widgets/spinning_square.dart +++ b/examples/layers/widgets/spinning_square.dart @@ -17,7 +17,7 @@ class _SpinningSquareState extends State with SingleTickerProvid super.initState(); // We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0 // represents an entire turn of the square whereas in the other examples - // we used 0.0 -> math.PI, which is only half a turn. + // we used 0.0 -> math.pi, which is only half a turn. _animation = new AnimationController( duration: const Duration(milliseconds: 3600), vsync: this, diff --git a/packages/flutter/lib/src/animation/animation_controller.dart b/packages/flutter/lib/src/animation/animation_controller.dart index 3ad51d2d5d..f88030cd15 100644 --- a/packages/flutter/lib/src/animation/animation_controller.dart +++ b/packages/flutter/lib/src/animation/animation_controller.dart @@ -34,7 +34,7 @@ final SpringDescription _kFlingSpringDescription = new SpringDescription.withDam ); const Tolerance _kFlingTolerance = const Tolerance( - velocity: double.INFINITY, + velocity: double.infinity, distance: 0.01, ); @@ -153,8 +153,8 @@ class AnimationController extends Animation @required TickerProvider vsync, }) : assert(value != null), assert(vsync != null), - lowerBound = double.NEGATIVE_INFINITY, - upperBound = double.INFINITY, + lowerBound = double.negativeInfinity, + upperBound = double.infinity, _direction = _AnimationDirection.forward { _ticker = vsync.createTicker(_tick); _internalSetValue(value); @@ -253,7 +253,7 @@ class AnimationController extends Animation double get velocity { if (!isAnimating) return 0.0; - return _simulation.dx(lastElapsedDuration.inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND); + return _simulation.dx(lastElapsedDuration.inMicroseconds.toDouble() / Duration.microsecondsPerSecond); } void _internalSetValue(double newValue) { @@ -382,10 +382,10 @@ class AnimationController extends Animation simulationDuration = this.duration * remainingFraction; } else if (target == value) { // Already at target, don't animate. - simulationDuration = Duration.ZERO; + simulationDuration = Duration.zero; } stop(); - if (simulationDuration == Duration.ZERO) { + if (simulationDuration == Duration.zero) { if (value != target) { _value = target.clamp(lowerBound, upperBound); notifyListeners(); @@ -396,7 +396,7 @@ class AnimationController extends Animation _checkStatusChanged(); return new TickerFuture.complete(); } - assert(simulationDuration > Duration.ZERO); + assert(simulationDuration > Duration.zero); assert(!isAnimating); return _startSimulation(new _InterpolationSimulation(_value, target, simulationDuration, curve)); } @@ -466,7 +466,7 @@ class AnimationController extends Animation assert(simulation != null); assert(!isAnimating); _simulation = simulation; - _lastElapsedDuration = Duration.ZERO; + _lastElapsedDuration = Duration.zero; _value = simulation.x(0.0).clamp(lowerBound, upperBound); final Future result = _ticker.start(); _status = (_direction == _AnimationDirection.forward) ? @@ -534,7 +534,7 @@ class AnimationController extends Animation void _tick(Duration elapsed) { _lastElapsedDuration = elapsed; - final double elapsedInSeconds = elapsed.inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; + final double elapsedInSeconds = elapsed.inMicroseconds.toDouble() / Duration.microsecondsPerSecond; assert(elapsedInSeconds >= 0.0); _value = _simulation.x(elapsedInSeconds).clamp(lowerBound, upperBound); if (_simulation.isDone(elapsedInSeconds)) { @@ -562,7 +562,7 @@ class _InterpolationSimulation extends Simulation { : assert(_begin != null), assert(_end != null), assert(duration != null && duration.inMicroseconds > 0), - _durationInSeconds = duration.inMicroseconds / Duration.MICROSECONDS_PER_SECOND; + _durationInSeconds = duration.inMicroseconds / Duration.microsecondsPerSecond; final double _durationInSeconds; final double _begin; @@ -592,7 +592,7 @@ class _InterpolationSimulation extends Simulation { class _RepeatingSimulation extends Simulation { _RepeatingSimulation(this.min, this.max, Duration period) - : _periodInSeconds = period.inMicroseconds / Duration.MICROSECONDS_PER_SECOND { + : _periodInSeconds = period.inMicroseconds / Duration.microsecondsPerSecond { assert(_periodInSeconds > 0.0); } diff --git a/packages/flutter/lib/src/animation/curves.dart b/packages/flutter/lib/src/animation/curves.dart index 5acd653de2..6e690da513 100644 --- a/packages/flutter/lib/src/animation/curves.dart +++ b/packages/flutter/lib/src/animation/curves.dart @@ -376,7 +376,7 @@ class ElasticInCurve extends Curve { assert(t >= 0.0 && t <= 1.0); final double s = period / 4.0; t = t - 1.0; - return -math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.PI * 2.0) / period); + return -math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period); } @override @@ -404,7 +404,7 @@ class ElasticOutCurve extends Curve { double transform(double t) { assert(t >= 0.0 && t <= 1.0); final double s = period / 4.0; - return math.pow(2.0, -10 * t) * math.sin((t - s) * (math.PI * 2.0) / period) + 1.0; + return math.pow(2.0, -10 * t) * math.sin((t - s) * (math.pi * 2.0) / period) + 1.0; } @override @@ -435,9 +435,9 @@ class ElasticInOutCurve extends Curve { final double s = period / 4.0; t = 2.0 * t - 1.0; if (t < 0.0) - return -0.5 * math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.PI * 2.0) / period); + return -0.5 * math.pow(2.0, 10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period); else - return math.pow(2.0, -10.0 * t) * math.sin((t - s) * (math.PI * 2.0) / period) * 0.5 + 1.0; + return math.pow(2.0, -10.0 * t) * math.sin((t - s) * (math.pi * 2.0) / period) * 0.5 + 1.0; } @override diff --git a/packages/flutter/lib/src/cupertino/activity_indicator.dart b/packages/flutter/lib/src/cupertino/activity_indicator.dart index 4cf9975d7e..1109de5250 100644 --- a/packages/flutter/lib/src/cupertino/activity_indicator.dart +++ b/packages/flutter/lib/src/cupertino/activity_indicator.dart @@ -79,7 +79,7 @@ class _CupertinoActivityIndicatorState extends State } } -const double _kTwoPI = math.PI * 2.0; +const double _kTwoPI = math.pi * 2.0; const int _kTickCount = 12; const int _kHalfTickCount = _kTickCount ~/ 2; const Color _kTickColor = CupertinoColors.lightBackgroundGray; diff --git a/packages/flutter/lib/src/cupertino/nav_bar.dart b/packages/flutter/lib/src/cupertino/nav_bar.dart index f10202ec1e..c5fcbb864a 100644 --- a/packages/flutter/lib/src/cupertino/nav_bar.dart +++ b/packages/flutter/lib/src/cupertino/nav_bar.dart @@ -500,7 +500,7 @@ class _CupertinoLargeTitleNavigationBarSliverDelegate // and behind the persistent bar. child: new OverflowBox( minHeight: 0.0, - maxHeight: double.INFINITY, + maxHeight: double.infinity, alignment: AlignmentDirectional.bottomStart, child: new Padding( padding: const EdgeInsetsDirectional.only( diff --git a/packages/flutter/lib/src/cupertino/text_selection.dart b/packages/flutter/lib/src/cupertino/text_selection.dart index 1e6587d39f..f07eb1696b 100644 --- a/packages/flutter/lib/src/cupertino/text_selection.dart +++ b/packages/flutter/lib/src/cupertino/text_selection.dart @@ -274,7 +274,7 @@ class _CupertinoTextSelectionControls extends TextSelectionControls { switch (type) { case TextSelectionHandleType.left: // The left handle is upside down on iOS. return new Transform( - transform: new Matrix4.rotationZ(math.PI) + transform: new Matrix4.rotationZ(math.pi) ..translate(-_kHandlesPadding, -_kHandlesPadding), child: handle ); diff --git a/packages/flutter/lib/src/foundation/binding.dart b/packages/flutter/lib/src/foundation/binding.dart index d1accd704a..43b67d8779 100644 --- a/packages/flutter/lib/src/foundation/binding.dart +++ b/packages/flutter/lib/src/foundation/binding.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert' show JSON; +import 'dart:convert' show json; import 'dart:developer' as developer; import 'dart:io' show exit; @@ -348,7 +348,7 @@ abstract class BindingBase { /// extension method is called. The callback must return a [Future] /// that either eventually completes to a return value in the form /// of a name/value map where the values can all be converted to - /// JSON using `JSON.encode()` (see [JsonCodec.encode]), or fails. In case of failure, the + /// JSON using `json.encode()` (see [JsonCodec.encode]), or fails. In case of failure, the /// failure is reported to the remote caller and is dumped to the /// logs. /// @@ -375,7 +375,7 @@ abstract class BindingBase { if (caughtException == null) { result['type'] = '_extensionType'; result['method'] = method; - return new developer.ServiceExtensionResponse.result(JSON.encode(result)); + return new developer.ServiceExtensionResponse.result(json.encode(result)); } else { FlutterError.reportError(new FlutterErrorDetails( exception: caughtException, @@ -384,7 +384,7 @@ abstract class BindingBase { )); return new developer.ServiceExtensionResponse.error( developer.ServiceExtensionResponse.extensionError, - JSON.encode({ + json.encode({ 'exception': caughtException.toString(), 'stack': caughtStack.toString(), 'method': method, diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index fdf1eacfaf..9d87dc096c 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -2238,9 +2238,9 @@ abstract class Diagnosticable { /// // default value so is not relevant. /// properties.add(new DoubleProperty('hitTestExtent', hitTestExtent, defaultValue: paintExtent)); /// - /// // maxWidth of double.INFINITY indicates the width is unconstrained and + /// // maxWidth of double.infinity indicates the width is unconstrained and /// // so maxWidth has no impact., - /// properties.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.INFINITY)); + /// properties.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity)); /// /// // Progress is a value between 0 and 1 or null. Showing it as a /// // percentage makes the meaning clear enough that the name can be diff --git a/packages/flutter/lib/src/foundation/serialization.dart b/packages/flutter/lib/src/foundation/serialization.dart index d43d5d8da5..875b909d58 100644 --- a/packages/flutter/lib/src/foundation/serialization.dart +++ b/packages/flutter/lib/src/foundation/serialization.dart @@ -11,7 +11,7 @@ import 'package:typed_data/typed_buffers.dart' show Uint8Buffer; /// A WriteBuffer instance can be used only once. Attempts to reuse will result /// in [NoSuchMethodError]s being thrown. /// -/// The byte order used is [Endianness.HOST_ENDIAN] throughout. +/// The byte order used is [Endian.host] throughout. class WriteBuffer { /// Creates an interface for incrementally building a [ByteData] instance. WriteBuffer() { @@ -31,32 +31,32 @@ class WriteBuffer { /// Write a Uint16 into the buffer. void putUint16(int value) { - _eightBytes.setUint16(0, value, Endianness.HOST_ENDIAN); + _eightBytes.setUint16(0, value, Endian.host); _buffer.addAll(_eightBytesAsList, 0, 2); } /// Write a Uint32 into the buffer. void putUint32(int value) { - _eightBytes.setUint32(0, value, Endianness.HOST_ENDIAN); + _eightBytes.setUint32(0, value, Endian.host); _buffer.addAll(_eightBytesAsList, 0, 4); } /// Write an Int32 into the buffer. void putInt32(int value) { - _eightBytes.setInt32(0, value, Endianness.HOST_ENDIAN); + _eightBytes.setInt32(0, value, Endian.host); _buffer.addAll(_eightBytesAsList, 0, 4); } /// Write an Int64 into the buffer. void putInt64(int value) { - _eightBytes.setInt64(0, value, Endianness.HOST_ENDIAN); + _eightBytes.setInt64(0, value, Endian.host); _buffer.addAll(_eightBytesAsList, 0, 8); } /// Write an Float64 into the buffer. void putFloat64(double value) { _alignTo(8); - _eightBytes.setFloat64(0, value, Endianness.HOST_ENDIAN); + _eightBytes.setFloat64(0, value, Endian.host); _buffer.addAll(_eightBytesAsList); } @@ -101,7 +101,7 @@ class WriteBuffer { /// Read-only buffer for reading sequentially from a [ByteData] instance. /// -/// The byte order used is [Endianness.HOST_ENDIAN] throughout. +/// The byte order used is [Endian.host] throughout. class ReadBuffer { /// Creates a [ReadBuffer] for reading from the specified [data]. ReadBuffer(this.data) @@ -123,28 +123,28 @@ class ReadBuffer { /// Reads a Uint16 from the buffer. int getUint16() { - final int value = data.getUint16(_position, Endianness.HOST_ENDIAN); + final int value = data.getUint16(_position, Endian.host); _position += 2; return value; } /// Reads a Uint32 from the buffer. int getUint32() { - final int value = data.getUint32(_position, Endianness.HOST_ENDIAN); + final int value = data.getUint32(_position, Endian.host); _position += 4; return value; } /// Reads an Int32 from the buffer. int getInt32() { - final int value = data.getInt32(_position, Endianness.HOST_ENDIAN); + final int value = data.getInt32(_position, Endian.host); _position += 4; return value; } /// Reads an Int64 from the buffer. int getInt64() { - final int value = data.getInt64(_position, Endianness.HOST_ENDIAN); + final int value = data.getInt64(_position, Endian.host); _position += 8; return value; } @@ -152,7 +152,7 @@ class ReadBuffer { /// Reads a Float64 from the buffer. double getFloat64() { _alignTo(8); - final double value = data.getFloat64(_position, Endianness.HOST_ENDIAN); + final double value = data.getFloat64(_position, Endian.host); _position += 8; return value; } diff --git a/packages/flutter/lib/src/gestures/events.dart b/packages/flutter/lib/src/gestures/events.dart index 41d4352ece..e8eac2dc5b 100644 --- a/packages/flutter/lib/src/gestures/events.dart +++ b/packages/flutter/lib/src/gestures/events.dart @@ -94,7 +94,7 @@ abstract class PointerEvent { /// Abstract const constructor. This constructor enables subclasses to provide /// const constructors so that they can be used in const expressions. const PointerEvent({ - this.timeStamp: Duration.ZERO, + this.timeStamp: Duration.zero, this.pointer: 0, this.kind: PointerDeviceKind.touch, this.device: 0, @@ -289,7 +289,7 @@ class PointerAddedEvent extends PointerEvent { /// /// All of the argument must be non-null. const PointerAddedEvent({ - Duration timeStamp: Duration.ZERO, + Duration timeStamp: Duration.zero, PointerDeviceKind kind: PointerDeviceKind.touch, int device: 0, Offset position: Offset.zero, @@ -328,7 +328,7 @@ class PointerRemovedEvent extends PointerEvent { /// /// All of the argument must be non-null. const PointerRemovedEvent({ - Duration timeStamp: Duration.ZERO, + Duration timeStamp: Duration.zero, PointerDeviceKind kind: PointerDeviceKind.touch, int device: 0, bool obscured: false, @@ -363,7 +363,7 @@ class PointerHoverEvent extends PointerEvent { /// /// All of the argument must be non-null. const PointerHoverEvent({ - Duration timeStamp: Duration.ZERO, + Duration timeStamp: Duration.zero, PointerDeviceKind kind: PointerDeviceKind.touch, int device: 0, Offset position: Offset.zero, @@ -410,7 +410,7 @@ class PointerDownEvent extends PointerEvent { /// /// All of the argument must be non-null. const PointerDownEvent({ - Duration timeStamp: Duration.ZERO, + Duration timeStamp: Duration.zero, int pointer: 0, PointerDeviceKind kind: PointerDeviceKind.touch, int device: 0, @@ -462,7 +462,7 @@ class PointerMoveEvent extends PointerEvent { /// /// All of the argument must be non-null. const PointerMoveEvent({ - Duration timeStamp: Duration.ZERO, + Duration timeStamp: Duration.zero, int pointer: 0, PointerDeviceKind kind: PointerDeviceKind.touch, int device: 0, @@ -512,7 +512,7 @@ class PointerUpEvent extends PointerEvent { /// /// All of the argument must be non-null. const PointerUpEvent({ - Duration timeStamp: Duration.ZERO, + Duration timeStamp: Duration.zero, int pointer: 0, PointerDeviceKind kind: PointerDeviceKind.touch, int device: 0, @@ -553,7 +553,7 @@ class PointerCancelEvent extends PointerEvent { /// /// All of the argument must be non-null. const PointerCancelEvent({ - Duration timeStamp: Duration.ZERO, + Duration timeStamp: Duration.zero, int pointer: 0, PointerDeviceKind kind: PointerDeviceKind.touch, int device: 0, diff --git a/packages/flutter/lib/src/gestures/multitap.dart b/packages/flutter/lib/src/gestures/multitap.dart index 6b6e7c5e55..7fd5205808 100644 --- a/packages/flutter/lib/src/gestures/multitap.dart +++ b/packages/flutter/lib/src/gestures/multitap.dart @@ -237,7 +237,7 @@ class _TapGesture extends _TapTracker { entry: GestureBinding.instance.gestureArena.add(event.pointer, gestureRecognizer) ) { startTrackingPointer(handleEvent); - if (longTapDelay > Duration.ZERO) { + if (longTapDelay > Duration.zero) { _timer = new Timer(longTapDelay, () { _timer = null; gestureRecognizer._dispatchLongTap(event.pointer, _lastPosition); @@ -313,10 +313,10 @@ class _TapGesture extends _TapTracker { class MultiTapGestureRecognizer extends GestureRecognizer { /// Creates a multi-tap gesture recognizer. /// - /// The [longTapDelay] defaults to [Duration.ZERO], which means + /// The [longTapDelay] defaults to [Duration.zero], which means /// [onLongTapDown] is called immediately after [onTapDown]. MultiTapGestureRecognizer({ - this.longTapDelay: Duration.ZERO, + this.longTapDelay: Duration.zero, Object debugOwner, }) : super(debugOwner: debugOwner); diff --git a/packages/flutter/lib/src/material/arc.dart b/packages/flutter/lib/src/material/arc.dart index 0d41f5c123..f0b5db156f 100644 --- a/packages/flutter/lib/src/material/arc.dart +++ b/packages/flutter/lib/src/material/arc.dart @@ -62,17 +62,17 @@ class MaterialPointArcTween extends Tween { _beginAngle = sweepAngle() * (begin.dy - end.dy).sign; _endAngle = 0.0; } else { - _beginAngle = math.PI + sweepAngle() * (end.dy - begin.dy).sign; - _endAngle = math.PI; + _beginAngle = math.pi + sweepAngle() * (end.dy - begin.dy).sign; + _endAngle = math.pi; } } else { _radius = distanceFromAtoB * distanceFromAtoB / (c - end).distance / 2.0; _center = new Offset(begin.dx, begin.dy + (end.dy - begin.dy).sign * _radius); if (begin.dy < end.dy) { - _beginAngle = -math.PI / 2.0; + _beginAngle = -math.pi / 2.0; _endAngle = _beginAngle + sweepAngle() * (end.dx - begin.dx).sign; } else { - _beginAngle = math.PI / 2.0; + _beginAngle = math.pi / 2.0; _endAngle = _beginAngle + sweepAngle() * (begin.dx - end.dx).sign; } } diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart index 8b732ce389..f75b781cc7 100644 --- a/packages/flutter/lib/src/material/data_table.dart +++ b/packages/flutter/lib/src/material/data_table.dart @@ -705,7 +705,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin { _opacityController.value = widget.visible ? 1.0 : 0.0; _orientationAnimation = new Tween( begin: 0.0, - end: math.PI, + end: math.pi, ).animate(new CurvedAnimation( parent: _orientationController = new AnimationController( duration: widget.duration, @@ -716,7 +716,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin { ..addListener(_rebuild) ..addStatusListener(_resetOrientationAnimation); if (widget.visible) - _orientationOffset = widget.down ? 0.0 : math.PI; + _orientationOffset = widget.down ? 0.0 : math.pi; } void _rebuild() { @@ -727,8 +727,8 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin { void _resetOrientationAnimation(AnimationStatus status) { if (status == AnimationStatus.completed) { - assert(_orientationAnimation.value == math.PI); - _orientationOffset += math.PI; + assert(_orientationAnimation.value == math.pi); + _orientationOffset += math.pi; _orientationController.value = 0.0; // TODO(ianh): This triggers a pointless rebuild. } } @@ -742,7 +742,7 @@ class _SortArrowState extends State<_SortArrow> with TickerProviderStateMixin { if (widget.visible && (_opacityController.status == AnimationStatus.dismissed)) { _orientationController.stop(); _orientationController.value = 0.0; - _orientationOffset = newDown ? 0.0 : math.PI; + _orientationOffset = newDown ? 0.0 : math.pi; skipArrow = true; } if (widget.visible) { diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart index 09b39d94b3..1ca931f1c4 100644 --- a/packages/flutter/lib/src/material/date_picker.dart +++ b/packages/flutter/lib/src/material/date_picker.dart @@ -204,7 +204,7 @@ class _DayPickerGridDelegate extends SliverGridDelegate { @override SliverGridLayout getLayout(SliverConstraints constraints) { - final int columnCount = DateTime.DAYS_PER_WEEK; + final int columnCount = DateTime.daysPerWeek; final double tileWidth = constraints.crossAxisExtent / columnCount; final double tileHeight = math.min(_kDayPickerRowHeight, constraints.viewportMainAxisExtent / (_kMaxDayPickerRowCount + 1)); return new SliverGridRegularTileLayout( @@ -319,7 +319,7 @@ class DayPicker extends StatelessWidget { /// This applies the leap year logic introduced by the Gregorian reforms of /// 1582. It will not give valid results for dates prior to that time. static int getDaysInMonth(int year, int month) { - if (month == DateTime.FEBRUARY) { + if (month == DateTime.february) { final bool isLeapYear = (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0); if (isLeapYear) return 29; diff --git a/packages/flutter/lib/src/material/input_border.dart b/packages/flutter/lib/src/material/input_border.dart index b098496630..e027e5eca1 100644 --- a/packages/flutter/lib/src/material/input_border.dart +++ b/packages/flutter/lib/src/material/input_border.dart @@ -365,19 +365,19 @@ class OutlineInputBorder extends InputBorder { center.blRadiusY * 2.0, ); - final double cornerArcSweep = math.PI / 2.0; + final double cornerArcSweep = math.pi / 2.0; final double tlCornerArcSweep = start < center.tlRadiusX ? math.asin(start / center.tlRadiusX) - : math.PI / 2.0; + : math.pi / 2.0; final Path path = new Path() - ..addArc(tlCorner, math.PI, tlCornerArcSweep) + ..addArc(tlCorner, math.pi, tlCornerArcSweep) ..moveTo(center.left + center.tlRadiusX, center.top); if (start > center.tlRadiusX) path.lineTo(center.left + start, center.top); - final double trCornerArcStart = (3 * math.PI) / 2.0; + final double trCornerArcStart = (3 * math.pi) / 2.0; final double trCornerArcSweep = cornerArcSweep; if (start + extent < center.width - center.trRadiusX) { path @@ -395,7 +395,7 @@ class OutlineInputBorder extends InputBorder { ..lineTo(center.right, center.bottom - center.brRadiusY) ..addArc(brCorner, 0.0, cornerArcSweep) ..lineTo(center.left + center.blRadiusX, center.bottom) - ..addArc(blCorner, math.PI / 2.0, cornerArcSweep) + ..addArc(blCorner, math.pi / 2.0, cornerArcSweep) ..lineTo(center.left, center.top + center.trRadiusY); } diff --git a/packages/flutter/lib/src/material/material_localizations.dart b/packages/flutter/lib/src/material/material_localizations.dart index 5f0d25a8bf..ecdcf786fc 100644 --- a/packages/flutter/lib/src/material/material_localizations.dart +++ b/packages/flutter/lib/src/material/material_localizations.dart @@ -305,7 +305,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations { /// function, rather than constructing this class directly. const DefaultMaterialLocalizations(); - // Ordered to match DateTime.MONDAY=1, DateTime.SUNDAY=6 + // Ordered to match DateTime.monday=1, DateTime.sunday=6 static const List _shortWeekdays = const [ 'Mon', 'Tue', @@ -316,7 +316,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations { 'Sun', ]; - // Ordered to match DateTime.MONDAY=1, DateTime.SUNDAY=6 + // Ordered to match DateTime.monday=1, DateTime.sunday=6 static const List _weekdays = const [ 'Monday', 'Tuesday', @@ -402,21 +402,21 @@ class DefaultMaterialLocalizations implements MaterialLocalizations { @override String formatMediumDate(DateTime date) { - final String day = _shortWeekdays[date.weekday - DateTime.MONDAY]; - final String month = _shortMonths[date.month - DateTime.JANUARY]; + final String day = _shortWeekdays[date.weekday - DateTime.monday]; + final String month = _shortMonths[date.month - DateTime.january]; return '$day, $month ${date.day}'; } @override String formatFullDate(DateTime date) { - final String month = _months[date.month - DateTime.JANUARY]; - return '${_weekdays[date.weekday - DateTime.MONDAY]}, $month ${date.day}, ${date.year}'; + final String month = _months[date.month - DateTime.january]; + return '${_weekdays[date.weekday - DateTime.monday]}, $month ${date.day}, ${date.year}'; } @override String formatMonthYear(DateTime date) { final String year = formatYear(date); - final String month = _months[date.month - DateTime.JANUARY]; + final String month = _months[date.month - DateTime.january]; return '$month $year'; } diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart index 853e4e6e37..d440fc93e3 100644 --- a/packages/flutter/lib/src/material/progress_indicator.dart +++ b/packages/flutter/lib/src/material/progress_indicator.dart @@ -204,7 +204,7 @@ class _LinearProgressIndicatorState extends State with Widget _buildIndicator(BuildContext context, double animationValue, TextDirection textDirection) { return new Container( constraints: const BoxConstraints.tightFor( - width: double.INFINITY, + width: double.infinity, height: _kLinearProgressIndicatorHeight, ), child: new CustomPaint( @@ -236,11 +236,11 @@ class _LinearProgressIndicatorState extends State with } class _CircularProgressIndicatorPainter extends CustomPainter { - static const double _kTwoPI = math.PI * 2.0; + static const double _kTwoPI = math.pi * 2.0; static const double _kEpsilon = .001; // Canvas.drawArc(r, 0, 2*PI) doesn't draw anything, so just get close. static const double _kSweep = _kTwoPI - _kEpsilon; - static const double _kStartAngle = -math.PI / 2.0; + static const double _kStartAngle = -math.pi / 2.0; _CircularProgressIndicatorPainter({ this.valueColor, @@ -252,10 +252,10 @@ class _CircularProgressIndicatorPainter extends CustomPainter { this.strokeWidth, }) : arcStart = value != null ? _kStartAngle - : _kStartAngle + tailValue * 3 / 2 * math.PI + rotationValue * math.PI * 1.7 - stepValue * 0.8 * math.PI, + : _kStartAngle + tailValue * 3 / 2 * math.pi + rotationValue * math.pi * 1.7 - stepValue * 0.8 * math.pi, arcSweep = value != null ? value.clamp(0.0, 1.0) * _kSweep - : math.max(headValue * 3 / 2 * math.PI - tailValue * 3 / 2 * math.PI, _kEpsilon); + : math.max(headValue * 3 / 2 * math.pi - tailValue * 3 / 2 * math.pi, _kEpsilon); final Color valueColor; final double value; diff --git a/packages/flutter/lib/src/material/text_selection.dart b/packages/flutter/lib/src/material/text_selection.dart index a2acf9e9dc..59349c1b02 100644 --- a/packages/flutter/lib/src/material/text_selection.dart +++ b/packages/flutter/lib/src/material/text_selection.dart @@ -169,14 +169,14 @@ class _MaterialTextSelectionControls extends TextSelectionControls { switch (type) { case TextSelectionHandleType.left: // points up-right return new Transform( - transform: new Matrix4.rotationZ(math.PI / 2.0), + transform: new Matrix4.rotationZ(math.pi / 2.0), child: handle ); case TextSelectionHandleType.right: // points up-left return handle; case TextSelectionHandleType.collapsed: // points up return new Transform( - transform: new Matrix4.rotationZ(math.PI / 4.0), + transform: new Matrix4.rotationZ(math.pi / 4.0), child: handle ); } diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart index 20328c1d3d..811c20d435 100644 --- a/packages/flutter/lib/src/material/time_picker.dart +++ b/packages/flutter/lib/src/material/time_picker.dart @@ -22,7 +22,7 @@ import 'time.dart'; import 'typography.dart'; const Duration _kDialAnimateDuration = const Duration(milliseconds: 200); -const double _kTwoPi = 2 * math.PI; +const double _kTwoPi = 2 * math.pi; const Duration _kVibrateCommitDelay = const Duration(milliseconds: 100); enum _TimePickerMode { hour, minute } @@ -861,7 +861,7 @@ class _DialPainter extends CustomPainter { if (labels == null) return; final double labelThetaIncrement = -_kTwoPi / labels.length; - double labelTheta = math.PI / 2.0; + double labelTheta = math.pi / 2.0; for (_TappableLabel label in labels) { final TextPainter labelPainter = label.painter; @@ -931,7 +931,7 @@ class _DialPainter extends CustomPainter { if (labels == null) return; final double labelThetaIncrement = -_kTwoPi / labels.length; - double labelTheta = math.PI / 2.0; + double labelTheta = math.pi / 2.0; for (_TappableLabel label in labels) { final TextPainter labelPainter = label.painter; @@ -1078,7 +1078,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { final double fraction = widget.mode == _TimePickerMode.hour ? (time.hour / TimeOfDay.hoursPerPeriod) % TimeOfDay.hoursPerPeriod : (time.minute / TimeOfDay.minutesPerHour) % TimeOfDay.minutesPerHour; - return (math.PI / 2.0 - fraction * _kTwoPi) % _kTwoPi; + return (math.pi / 2.0 - fraction * _kTwoPi) % _kTwoPi; } TimeOfDay _getTimeForTheta(double theta) { @@ -1115,7 +1115,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { void _updateThetaForPan() { setState(() { final Offset offset = _position - _center; - final double angle = (math.atan2(offset.dx, offset.dy) - math.PI / 2.0) % _kTwoPi; + final double angle = (math.atan2(offset.dx, offset.dy) - math.pi / 2.0) % _kTwoPi; _thetaTween ..begin = angle ..end = angle; // The controller doesn't animate during the pan gesture. diff --git a/packages/flutter/lib/src/painting/image_resolution.dart b/packages/flutter/lib/src/painting/image_resolution.dart index b38738f878..c7cb5525bd 100644 --- a/packages/flutter/lib/src/painting/image_resolution.dart +++ b/packages/flutter/lib/src/painting/image_resolution.dart @@ -210,11 +210,11 @@ class AssetImage extends AssetBundleImageProvider { return completer.future; } - static Future>> _manifestParser(String json) { - if (json == null) + static Future>> _manifestParser(String jsonData) { + if (jsonData == null) return null; // TODO(ianh): JSON decoding really shouldn't be on the main thread. - final Map parsedJson = JSON.decode(json); + final Map parsedJson = json.decode(jsonData); final Iterable keys = parsedJson.keys; final Map> parsedManifest = new Map>.fromIterables(keys, diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart index d80c210268..ec1cb62a0f 100644 --- a/packages/flutter/lib/src/painting/text_painter.dart +++ b/packages/flutter/lib/src/painting/text_painter.dart @@ -228,7 +228,7 @@ class TextPainter { builder.pushStyle(text.style.getTextStyle(textScaleFactor: textScaleFactor)); builder.addText(_kZeroWidthSpace); _layoutTemplate = builder.build() - ..layout(new ui.ParagraphConstraints(width: double.INFINITY)); + ..layout(new ui.ParagraphConstraints(width: double.infinity)); } return _layoutTemplate.height; } @@ -297,7 +297,7 @@ class TextPainter { builder.pushStyle(text.style.getTextStyle(textScaleFactor: textScaleFactor)); builder.addText(_kZeroWidthSpace); final ui.Paragraph paragraph = builder.build() - ..layout(new ui.ParagraphConstraints(width: double.INFINITY)); + ..layout(new ui.ParagraphConstraints(width: double.infinity)); switch (baseline) { case TextBaseline.alphabetic: @@ -351,7 +351,7 @@ class TextPainter { /// /// The [text] and [textDirection] properties must be non-null before this is /// called. - void layout({ double minWidth: 0.0, double maxWidth: double.INFINITY }) { + void layout({ double minWidth: 0.0, double maxWidth: double.infinity }) { assert(text != null, 'TextPainter.text must be set to a non-null value before using the TextPainter.'); assert(textDirection != null, 'TextPainter.textDirection must be set to a non-null value before using the TextPainter.'); if (!_needsLayout && minWidth == _lastMinWidth && maxWidth == _lastMaxWidth) diff --git a/packages/flutter/lib/src/physics/clamped_simulation.dart b/packages/flutter/lib/src/physics/clamped_simulation.dart index ab80f33796..fe97425095 100644 --- a/packages/flutter/lib/src/physics/clamped_simulation.dart +++ b/packages/flutter/lib/src/physics/clamped_simulation.dart @@ -22,10 +22,10 @@ class ClampedSimulation extends Simulation { /// The named arguments specify the ranges for the clamping behavior, as /// applied to [x] and [dx]. ClampedSimulation(this.simulation, { - this.xMin: double.NEGATIVE_INFINITY, - this.xMax: double.INFINITY, - this.dxMin: double.NEGATIVE_INFINITY, - this.dxMax: double.INFINITY + this.xMin: double.negativeInfinity, + this.xMax: double.infinity, + this.dxMin: double.negativeInfinity, + this.dxMax: double.infinity }) : assert(simulation != null), assert(xMax >= xMin), assert(dxMax >= dxMin); diff --git a/packages/flutter/lib/src/physics/friction_simulation.dart b/packages/flutter/lib/src/physics/friction_simulation.dart index 8fa5cf18d8..ca5052365d 100644 --- a/packages/flutter/lib/src/physics/friction_simulation.dart +++ b/packages/flutter/lib/src/physics/friction_simulation.dart @@ -62,7 +62,7 @@ class FrictionSimulation extends Simulation { // Solving for D given x(time) is trickier. Algebra courtesy of Wolfram Alpha: // x1 = x0 + (v0 * D^((log(v1) - log(v0)) / log(D))) / log(D) - v0 / log(D), find D static double _dragFor(double startPosition, double endPosition, double startVelocity, double endVelocity) { - return math.pow(math.E, (startVelocity - endVelocity) / (startPosition - endPosition)); + return math.pow(math.e, (startVelocity - endVelocity) / (startPosition - endPosition)); } @override @@ -71,17 +71,17 @@ class FrictionSimulation extends Simulation { @override double dx(double time) => _v * math.pow(_drag, time); - /// The value of [x] at `double.INFINITY`. + /// The value of [x] at `double.infinity`. double get finalX => _x - _v / _dragLog; /// The time at which the value of `x(time)` will equal [x]. /// - /// Returns `double.INFINITY` if the simulation will never reach [x]. + /// Returns `double.infinity` if the simulation will never reach [x]. double timeAtX(double x) { if (x == _x) return 0.0; if (_v == 0.0 || (_v > 0 ? (x < _x || x > finalX) : (x > _x || x < finalX))) - return double.INFINITY; + return double.infinity; return math.log(_dragLog * (x - _x) / _v + 1.0) / _dragLog; } diff --git a/packages/flutter/lib/src/physics/spring_simulation.dart b/packages/flutter/lib/src/physics/spring_simulation.dart index df16a049d2..786886e3e4 100644 --- a/packages/flutter/lib/src/physics/spring_simulation.dart +++ b/packages/flutter/lib/src/physics/spring_simulation.dart @@ -191,12 +191,12 @@ class _CriticalSolution implements _SpringSolution { @override double x(double time) { - return (_c1 + _c2 * time) * math.pow(math.E, _r * time); + return (_c1 + _c2 * time) * math.pow(math.e, _r * time); } @override double dx(double time) { - final double power = math.pow(math.E, _r * time); + final double power = math.pow(math.e, _r * time); return _r * (_c1 + _c2 * time) * power + _c2 * power; } @@ -228,14 +228,14 @@ class _OverdampedSolution implements _SpringSolution { @override double x(double time) { - return _c1 * math.pow(math.E, _r1 * time) + - _c2 * math.pow(math.E, _r2 * time); + return _c1 * math.pow(math.e, _r1 * time) + + _c2 * math.pow(math.e, _r2 * time); } @override double dx(double time) { - return _c1 * _r1 * math.pow(math.E, _r1 * time) + - _c2 * _r2 * math.pow(math.E, _r2 * time); + return _c1 * _r1 * math.pow(math.e, _r1 * time) + + _c2 * _r2 * math.pow(math.e, _r2 * time); } @override @@ -266,13 +266,13 @@ class _UnderdampedSolution implements _SpringSolution { @override double x(double time) { - return math.pow(math.E, _r * time) * + return math.pow(math.e, _r * time) * (_c1 * math.cos(_w * time) + _c2 * math.sin(_w * time)); } @override double dx(double time) { - final double power = math.pow(math.E, _r * time); + final double power = math.pow(math.e, _r * time); final double cosine = math.cos(_w * time); final double sine = math.sin(_w * time); return power * (_c2 * _w * cosine - _c1 * _w * sine) + diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index 211d8cd329..6ce6fdd0b0 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -30,10 +30,10 @@ class _DebugSize extends Size { /// /// The constraints themselves must satisfy these relations: /// -/// * 0.0 <= [minWidth] <= [maxWidth] <= [double.INFINITY] -/// * 0.0 <= [minHeight] <= [maxHeight] <= [double.INFINITY] +/// * 0.0 <= [minWidth] <= [maxWidth] <= [double.infinity] +/// * 0.0 <= [minHeight] <= [maxHeight] <= [double.infinity] /// -/// [double.INFINITY] is a legal value for each constraint. +/// [double.infinity] is a legal value for each constraint. /// /// ## The box layout model /// @@ -83,9 +83,9 @@ class BoxConstraints extends Constraints { /// Creates box constraints with the given constraints. const BoxConstraints({ this.minWidth: 0.0, - this.maxWidth: double.INFINITY, + this.maxWidth: double.infinity, this.minHeight: 0.0, - this.maxHeight: double.INFINITY + this.maxHeight: double.infinity }); /// The minimum width that satisfies the constraints. @@ -93,7 +93,7 @@ class BoxConstraints extends Constraints { /// The maximum width that satisfies the constraints. /// - /// Might be [double.INFINITY]. + /// Might be [double.infinity]. final double maxWidth; /// The minimum height that satisfies the constraints. @@ -101,7 +101,7 @@ class BoxConstraints extends Constraints { /// The maximum height that satisfies the constraints. /// - /// Might be [double.INFINITY]. + /// Might be [double.infinity]. final double maxHeight; /// Creates box constraints that is respected only by the given size. @@ -122,9 +122,9 @@ class BoxConstraints extends Constraints { double width, double height }): minWidth = width != null ? width : 0.0, - maxWidth = width != null ? width : double.INFINITY, + maxWidth = width != null ? width : double.infinity, minHeight = height != null ? height : 0.0, - maxHeight = height != null ? height : double.INFINITY; + maxHeight = height != null ? height : double.infinity; /// Creates box constraints that require the given width or height, except if /// they are infinite. @@ -134,12 +134,12 @@ class BoxConstraints extends Constraints { /// * [new BoxConstraints.tightFor], which is similar but instead of being /// tight if the value is not infinite, is tight if the value is non-null. const BoxConstraints.tightForFinite({ - double width: double.INFINITY, - double height: double.INFINITY - }): minWidth = width != double.INFINITY ? width : 0.0, - maxWidth = width != double.INFINITY ? width : double.INFINITY, - minHeight = height != double.INFINITY ? height : 0.0, - maxHeight = height != double.INFINITY ? height : double.INFINITY; + double width: double.infinity, + double height: double.infinity + }): minWidth = width != double.infinity ? width : 0.0, + maxWidth = width != double.infinity ? width : double.infinity, + minHeight = height != double.infinity ? height : 0.0, + maxHeight = height != double.infinity ? height : double.infinity; /// Creates box constraints that forbid sizes larger than the given size. BoxConstraints.loose(Size size) @@ -155,10 +155,10 @@ class BoxConstraints extends Constraints { const BoxConstraints.expand({ double width, double height - }): minWidth = width != null ? width : double.INFINITY, - maxWidth = width != null ? width : double.INFINITY, - minHeight = height != null ? height : double.INFINITY, - maxHeight = height != null ? height : double.INFINITY; + }): minWidth = width != null ? width : double.infinity, + maxWidth = width != null ? width : double.infinity, + minHeight = height != null ? height : double.infinity, + maxHeight = height != null ? height : double.infinity; /// Creates a copy of this box constraints but with the given fields replaced with the new values. BoxConstraints copyWith({ @@ -243,14 +243,14 @@ class BoxConstraints extends Constraints { /// Returns the width that both satisfies the constraints and is as close as /// possible to the given width. - double constrainWidth([double width = double.INFINITY]) { + double constrainWidth([double width = double.infinity]) { assert(debugAssertIsValid()); return width.clamp(minWidth, maxWidth); } /// Returns the height that both satisfies the constraints and is as close as /// possible to the given height. - double constrainHeight([double height = double.INFINITY]) { + double constrainHeight([double height = double.infinity]) { assert(debugAssertIsValid()); return height.clamp(minHeight, maxHeight); } @@ -346,10 +346,10 @@ class BoxConstraints extends Constraints { bool get isTight => hasTightWidth && hasTightHeight; /// Whether there is an upper bound on the maximum width. - bool get hasBoundedWidth => maxWidth < double.INFINITY; + bool get hasBoundedWidth => maxWidth < double.infinity; /// Whether there is an upper bound on the maximum height. - bool get hasBoundedHeight => maxHeight < double.INFINITY; + bool get hasBoundedHeight => maxHeight < double.infinity; /// Whether the given size satisfies the constraints. bool isSatisfiedBy(Size size) { @@ -424,15 +424,15 @@ class BoxConstraints extends Constraints { return a * (1.0 - t); assert(a.debugAssertIsValid()); assert(b.debugAssertIsValid()); - assert((a.minWidth.isFinite && b.minWidth.isFinite) || (a.minWidth == double.INFINITY && b.minWidth == double.INFINITY), 'Cannot interpolate between finite constraints and unbounded constraints.'); - assert((a.maxWidth.isFinite && b.maxWidth.isFinite) || (a.maxWidth == double.INFINITY && b.maxWidth == double.INFINITY), 'Cannot interpolate between finite constraints and unbounded constraints.'); - assert((a.minHeight.isFinite && b.minHeight.isFinite) || (a.minHeight == double.INFINITY && b.minHeight == double.INFINITY), 'Cannot interpolate between finite constraints and unbounded constraints.'); - assert((a.maxHeight.isFinite && b.maxHeight.isFinite) || (a.maxHeight == double.INFINITY && b.maxHeight == double.INFINITY), 'Cannot interpolate between finite constraints and unbounded constraints.'); + assert((a.minWidth.isFinite && b.minWidth.isFinite) || (a.minWidth == double.infinity && b.minWidth == double.infinity), 'Cannot interpolate between finite constraints and unbounded constraints.'); + assert((a.maxWidth.isFinite && b.maxWidth.isFinite) || (a.maxWidth == double.infinity && b.maxWidth == double.infinity), 'Cannot interpolate between finite constraints and unbounded constraints.'); + assert((a.minHeight.isFinite && b.minHeight.isFinite) || (a.minHeight == double.infinity && b.minHeight == double.infinity), 'Cannot interpolate between finite constraints and unbounded constraints.'); + assert((a.maxHeight.isFinite && b.maxHeight.isFinite) || (a.maxHeight == double.infinity && b.maxHeight == double.infinity), 'Cannot interpolate between finite constraints and unbounded constraints.'); return new BoxConstraints( - minWidth: a.minWidth.isFinite ? ui.lerpDouble(a.minWidth, b.minWidth, t) : double.INFINITY, - maxWidth: a.maxWidth.isFinite ? ui.lerpDouble(a.maxWidth, b.maxWidth, t) : double.INFINITY, - minHeight: a.minHeight.isFinite ? ui.lerpDouble(a.minHeight, b.minHeight, t) : double.INFINITY, - maxHeight: a.maxHeight.isFinite ? ui.lerpDouble(a.maxHeight, b.maxHeight, t) : double.INFINITY, + minWidth: a.minWidth.isFinite ? ui.lerpDouble(a.minWidth, b.minWidth, t) : double.infinity, + maxWidth: a.maxWidth.isFinite ? ui.lerpDouble(a.maxWidth, b.maxWidth, t) : double.infinity, + minHeight: a.minHeight.isFinite ? ui.lerpDouble(a.minHeight, b.minHeight, t) : double.infinity, + maxHeight: a.maxHeight.isFinite ? ui.lerpDouble(a.maxHeight, b.maxHeight, t) : double.infinity, ); } @@ -557,10 +557,10 @@ class BoxConstraints extends Constraints { @override String toString() { final String annotation = isNormalized ? '' : '; NOT NORMALIZED'; - if (minWidth == double.INFINITY && minHeight == double.INFINITY) + if (minWidth == double.infinity && minHeight == double.infinity) return 'BoxConstraints(biggest$annotation)'; - if (minWidth == 0 && maxWidth == double.INFINITY && - minHeight == 0 && maxHeight == double.INFINITY) + if (minWidth == 0 && maxWidth == double.infinity && + minHeight == 0 && maxHeight == double.infinity) return 'BoxConstraints(unconstrained$annotation)'; String describe(double min, double max, String dim) { if (min == max) @@ -1089,7 +1089,7 @@ abstract class RenderBox extends RenderObject { throw new FlutterError( 'The height argument to getMinIntrinsicWidth was null.\n' 'The argument to getMinIntrinsicWidth must not be negative or null. ' - 'If you do not have a specific height in mind, then pass double.INFINITY instead.' + 'If you do not have a specific height in mind, then pass double.infinity instead.' ); } if (height < 0.0) { @@ -1228,7 +1228,7 @@ abstract class RenderBox extends RenderObject { throw new FlutterError( 'The height argument to getMaxIntrinsicWidth was null.\n' 'The argument to getMaxIntrinsicWidth must not be negative or null. ' - 'If you do not have a specific height in mind, then pass double.INFINITY instead.' + 'If you do not have a specific height in mind, then pass double.infinity instead.' ); } if (height < 0.0) { @@ -1304,7 +1304,7 @@ abstract class RenderBox extends RenderObject { throw new FlutterError( 'The width argument to getMinIntrinsicHeight was null.\n' 'The argument to getMinIntrinsicHeight must not be negative or null. ' - 'If you do not have a specific width in mind, then pass double.INFINITY instead.' + 'If you do not have a specific width in mind, then pass double.infinity instead.' ); } if (width < 0.0) { @@ -1377,7 +1377,7 @@ abstract class RenderBox extends RenderObject { throw new FlutterError( 'The width argument to getMaxIntrinsicHeight was null.\n' 'The argument to getMaxIntrinsicHeight must not be negative or null. ' - 'If you do not have a specific width in mind, then pass double.INFINITY instead.' + 'If you do not have a specific width in mind, then pass double.infinity instead.' ); } if (width < 0.0) { @@ -1747,8 +1747,8 @@ abstract class RenderBox extends RenderObject { } } - testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', double.INFINITY); - testIntrinsicsForValues(getMinIntrinsicHeight, getMaxIntrinsicHeight, 'Height', double.INFINITY); + testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', double.infinity); + testIntrinsicsForValues(getMinIntrinsicHeight, getMaxIntrinsicHeight, 'Height', double.infinity); if (constraints.hasBoundedWidth) testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, 'Width', constraints.maxWidth); if (constraints.hasBoundedHeight) diff --git a/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart b/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart index 8aa086d83a..3df67c87bd 100644 --- a/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart +++ b/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart @@ -148,7 +148,7 @@ abstract class DebugOverflowIndicatorMixin extends RenderObject { label: 'LEFT OVERFLOWED BY ${_formatPixels(overflow.left)} PIXELS', labelOffset: markerRect.centerLeft + const Offset(_indicatorFontSizePixels + _indicatorLabelPaddingPixels, 0.0), - rotation: math.PI / 2.0, + rotation: math.pi / 2.0, side: _OverflowSide.left, )); } @@ -164,7 +164,7 @@ abstract class DebugOverflowIndicatorMixin extends RenderObject { label: 'RIGHT OVERFLOWED BY ${_formatPixels(overflow.right)} PIXELS', labelOffset: markerRect.centerRight - const Offset(_indicatorFontSizePixels + _indicatorLabelPaddingPixels, 0.0), - rotation: -math.PI / 2.0, + rotation: -math.pi / 2.0, side: _OverflowSide.right, )); } diff --git a/packages/flutter/lib/src/rendering/editable.dart b/packages/flutter/lib/src/rendering/editable.dart index d9dd5e67e4..9ab7a5f16e 100644 --- a/packages/flutter/lib/src/rendering/editable.dart +++ b/packages/flutter/lib/src/rendering/editable.dart @@ -512,13 +512,13 @@ class RenderEditable extends RenderBox { @override double computeMinIntrinsicWidth(double height) { - _layoutText(double.INFINITY); + _layoutText(double.infinity); return _textPainter.minIntrinsicWidth; } @override double computeMaxIntrinsicWidth(double height) { - _layoutText(double.INFINITY); + _layoutText(double.infinity); return _textPainter.maxIntrinsicWidth; } @@ -529,7 +529,7 @@ class RenderEditable extends RenderBox { double _preferredHeight(double width) { if (maxLines != null) return preferredLineHeight * maxLines; - if (width == double.INFINITY) { + if (width == double.infinity) { final String text = _textPainter.text.toPlainText(); int lines = 1; for (int index = 0; index < text.length; index += 1) { @@ -646,7 +646,7 @@ class RenderEditable extends RenderBox { return; final double caretMargin = _kCaretGap + _kCaretWidth; final double availableWidth = math.max(0.0, constraintWidth - caretMargin); - final double maxWidth = _isMultiline ? availableWidth : double.INFINITY; + final double maxWidth = _isMultiline ? availableWidth : double.infinity; _textPainter.layout(minWidth: availableWidth, maxWidth: maxWidth); _textLayoutLastWidth = constraintWidth; } diff --git a/packages/flutter/lib/src/rendering/flex.dart b/packages/flutter/lib/src/rendering/flex.dart index a515b60305..30d868c466 100644 --- a/packages/flutter/lib/src/rendering/flex.dart +++ b/packages/flutter/lib/src/rendering/flex.dart @@ -524,11 +524,11 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin 0 || crossAxisAlignment == CrossAxisAlignment.baseline) { - final double spacePerFlex = canFlex && totalFlex > 0 ? (freeSpace / totalFlex) : double.NAN; + final double spacePerFlex = canFlex && totalFlex > 0 ? (freeSpace / totalFlex) : double.nan; child = firstChild; while (child != null) { final int flex = _getFlex(child); if (flex > 0) { - final double maxChildExtent = canFlex ? (child == lastFlexChild ? (freeSpace - allocatedFlexSpace) : spacePerFlex * flex) : double.INFINITY; + final double maxChildExtent = canFlex ? (child == lastFlexChild ? (freeSpace - allocatedFlexSpace) : spacePerFlex * flex) : double.infinity; double minChildExtent; switch (_getFit(child)) { case FlexFit.tight: - assert(maxChildExtent < double.INFINITY); + assert(maxChildExtent < double.infinity); minChildExtent = maxChildExtent; break; case FlexFit.loose: diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index 3da8eb1332..c1f47c87b3 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -502,7 +502,7 @@ abstract class Constraints { /// This might involve checks more detailed than [isNormalized]. /// /// For example, the [BoxConstraints] subclass verifies that the constraints - /// are not [double.NAN]. + /// are not [double.nan]. /// /// If the `isAppliedConstraint` argument is true, then even stricter rules /// are enforced. This argument is set to true when checking constraints that diff --git a/packages/flutter/lib/src/rendering/paragraph.dart b/packages/flutter/lib/src/rendering/paragraph.dart index ed71790af6..435321e6d0 100644 --- a/packages/flutter/lib/src/rendering/paragraph.dart +++ b/packages/flutter/lib/src/rendering/paragraph.dart @@ -174,9 +174,9 @@ class RenderParagraph extends RenderBox { markNeedsLayout(); } - void _layoutText({ double minWidth: 0.0, double maxWidth: double.INFINITY }) { + void _layoutText({ double minWidth: 0.0, double maxWidth: double.infinity }) { final bool widthMatters = softWrap || overflow == TextOverflow.ellipsis; - _textPainter.layout(minWidth: minWidth, maxWidth: widthMatters ? maxWidth : double.INFINITY); + _textPainter.layout(minWidth: minWidth, maxWidth: widthMatters ? maxWidth : double.infinity); } void _layoutTextWithConstraints(BoxConstraints constraints) { diff --git a/packages/flutter/lib/src/rendering/performance_overlay.dart b/packages/flutter/lib/src/rendering/performance_overlay.dart index d8e34a4422..c48118ca01 100644 --- a/packages/flutter/lib/src/rendering/performance_overlay.dart +++ b/packages/flutter/lib/src/rendering/performance_overlay.dart @@ -162,7 +162,7 @@ class RenderPerformanceOverlay extends RenderBox { @override void performResize() { - size = constraints.constrain(new Size(double.INFINITY, _intrinsicHeight)); + size = constraints.constrain(new Size(double.infinity, _intrinsicHeight)); } @override diff --git a/packages/flutter/lib/src/rendering/proxy_box.dart b/packages/flutter/lib/src/rendering/proxy_box.dart index fc685b608d..6deff8993a 100644 --- a/packages/flutter/lib/src/rendering/proxy_box.dart +++ b/packages/flutter/lib/src/rendering/proxy_box.dart @@ -302,8 +302,8 @@ class RenderLimitedBox extends RenderProxyBox { /// non-negative. RenderLimitedBox({ RenderBox child, - double maxWidth: double.INFINITY, - double maxHeight: double.INFINITY + double maxWidth: double.infinity, + double maxHeight: double.infinity }) : assert(maxWidth != null && maxWidth >= 0.0), assert(maxHeight != null && maxHeight >= 0.0), _maxWidth = maxWidth, @@ -354,8 +354,8 @@ class RenderLimitedBox extends RenderProxyBox { @override void debugFillProperties(DiagnosticPropertiesBuilder description) { super.debugFillProperties(description); - description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.INFINITY)); - description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.INFINITY)); + description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity)); + description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.infinity)); } } @@ -591,7 +591,7 @@ class RenderIntrinsicWidth extends RenderProxyBox { if (child == null) return 0.0; if (!width.isFinite) - width = computeMaxIntrinsicWidth(double.INFINITY); + width = computeMaxIntrinsicWidth(double.infinity); assert(width.isFinite); final double height = child.getMinIntrinsicHeight(width); return _applyStep(height, _stepHeight); @@ -602,7 +602,7 @@ class RenderIntrinsicWidth extends RenderProxyBox { if (child == null) return 0.0; if (!width.isFinite) - width = computeMaxIntrinsicWidth(double.INFINITY); + width = computeMaxIntrinsicWidth(double.infinity); assert(width.isFinite); final double height = child.getMaxIntrinsicHeight(width); return _applyStep(height, _stepHeight); @@ -658,7 +658,7 @@ class RenderIntrinsicHeight extends RenderProxyBox { if (child == null) return 0.0; if (!height.isFinite) - height = child.getMaxIntrinsicHeight(double.INFINITY); + height = child.getMaxIntrinsicHeight(double.infinity); assert(height.isFinite); return child.getMinIntrinsicWidth(height); } @@ -668,7 +668,7 @@ class RenderIntrinsicHeight extends RenderProxyBox { if (child == null) return 0.0; if (!height.isFinite) - height = child.getMaxIntrinsicHeight(double.INFINITY); + height = child.getMaxIntrinsicHeight(double.infinity); assert(height.isFinite); return child.getMaxIntrinsicWidth(height); } @@ -4039,10 +4039,10 @@ class RenderFollowerLayer extends RenderProxyBox { Offset.zero, childPaintBounds: new Rect.fromLTRB( // We don't know where we'll end up, so we have no idea what our cull rect should be. - double.NEGATIVE_INFINITY, - double.NEGATIVE_INFINITY, - double.INFINITY, - double.INFINITY, + double.negativeInfinity, + double.negativeInfinity, + double.infinity, + double.infinity, ), ); } diff --git a/packages/flutter/lib/src/rendering/rotated_box.dart b/packages/flutter/lib/src/rendering/rotated_box.dart index 3db3641319..cf52abda9f 100644 --- a/packages/flutter/lib/src/rendering/rotated_box.dart +++ b/packages/flutter/lib/src/rendering/rotated_box.dart @@ -12,7 +12,7 @@ import 'package:vector_math/vector_math_64.dart'; import 'box.dart'; import 'object.dart'; -const double _kQuarterTurnsInRadians = math.PI / 2.0; +const double _kQuarterTurnsInRadians = math.pi / 2.0; /// Rotates its child by a integral number of quarter turns. /// diff --git a/packages/flutter/lib/src/rendering/shifted_box.dart b/packages/flutter/lib/src/rendering/shifted_box.dart index 2a12f40973..af26d4c276 100644 --- a/packages/flutter/lib/src/rendering/shifted_box.dart +++ b/packages/flutter/lib/src/rendering/shifted_box.dart @@ -149,7 +149,7 @@ class RenderPadding extends RenderShiftedBox { _resolve(); final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right; final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom; - if (child != null) // next line relies on double.INFINITY absorption + if (child != null) // next line relies on double.infinity absorption return child.getMinIntrinsicWidth(math.max(0.0, height - totalVerticalPadding)) + totalHorizontalPadding; return totalHorizontalPadding; } @@ -159,7 +159,7 @@ class RenderPadding extends RenderShiftedBox { _resolve(); final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right; final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom; - if (child != null) // next line relies on double.INFINITY absorption + if (child != null) // next line relies on double.infinity absorption return child.getMaxIntrinsicWidth(math.max(0.0, height - totalVerticalPadding)) + totalHorizontalPadding; return totalHorizontalPadding; } @@ -169,7 +169,7 @@ class RenderPadding extends RenderShiftedBox { _resolve(); final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right; final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom; - if (child != null) // next line relies on double.INFINITY absorption + if (child != null) // next line relies on double.infinity absorption return child.getMinIntrinsicHeight(math.max(0.0, width - totalHorizontalPadding)) + totalVerticalPadding; return totalVerticalPadding; } @@ -179,7 +179,7 @@ class RenderPadding extends RenderShiftedBox { _resolve(); final double totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right; final double totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom; - if (child != null) // next line relies on double.INFINITY absorption + if (child != null) // next line relies on double.infinity absorption return child.getMaxIntrinsicHeight(math.max(0.0, width - totalHorizontalPadding)) + totalVerticalPadding; return totalVerticalPadding; } @@ -374,17 +374,17 @@ class RenderPositionedBox extends RenderAligningShiftedBox { @override void performLayout() { - final bool shrinkWrapWidth = _widthFactor != null || constraints.maxWidth == double.INFINITY; - final bool shrinkWrapHeight = _heightFactor != null || constraints.maxHeight == double.INFINITY; + final bool shrinkWrapWidth = _widthFactor != null || constraints.maxWidth == double.infinity; + final bool shrinkWrapHeight = _heightFactor != null || constraints.maxHeight == double.infinity; if (child != null) { child.layout(constraints.loosen(), parentUsesSize: true); - size = constraints.constrain(new Size(shrinkWrapWidth ? child.size.width * (_widthFactor ?? 1.0) : double.INFINITY, - shrinkWrapHeight ? child.size.height * (_heightFactor ?? 1.0) : double.INFINITY)); + size = constraints.constrain(new Size(shrinkWrapWidth ? child.size.width * (_widthFactor ?? 1.0) : double.infinity, + shrinkWrapHeight ? child.size.height * (_heightFactor ?? 1.0) : double.infinity)); alignChild(); } else { - size = constraints.constrain(new Size(shrinkWrapWidth ? 0.0 : double.INFINITY, - shrinkWrapHeight ? 0.0 : double.INFINITY)); + size = constraints.constrain(new Size(shrinkWrapWidth ? 0.0 : double.infinity, + shrinkWrapHeight ? 0.0 : double.infinity)); } } @@ -870,7 +870,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox { double result; if (child == null) { result = super.computeMinIntrinsicWidth(height); - } else { // the following line relies on double.INFINITY absorption + } else { // the following line relies on double.infinity absorption result = child.getMinIntrinsicWidth(height * (_heightFactor ?? 1.0)); } assert(result.isFinite); @@ -882,7 +882,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox { double result; if (child == null) { result = super.computeMaxIntrinsicWidth(height); - } else { // the following line relies on double.INFINITY absorption + } else { // the following line relies on double.infinity absorption result = child.getMaxIntrinsicWidth(height * (_heightFactor ?? 1.0)); } assert(result.isFinite); @@ -894,7 +894,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox { double result; if (child == null) { result = super.computeMinIntrinsicHeight(width); - } else { // the following line relies on double.INFINITY absorption + } else { // the following line relies on double.infinity absorption result = child.getMinIntrinsicHeight(width * (_widthFactor ?? 1.0)); } assert(result.isFinite); @@ -906,7 +906,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox { double result; if (child == null) { result = super.computeMaxIntrinsicHeight(width); - } else { // the following line relies on double.INFINITY absorption + } else { // the following line relies on double.infinity absorption result = child.getMaxIntrinsicHeight(width * (_widthFactor ?? 1.0)); } assert(result.isFinite); diff --git a/packages/flutter/lib/src/rendering/sliver.dart b/packages/flutter/lib/src/rendering/sliver.dart index 6efb6fe69e..a81fc2a375 100644 --- a/packages/flutter/lib/src/rendering/sliver.dart +++ b/packages/flutter/lib/src/rendering/sliver.dart @@ -296,7 +296,7 @@ class SliverConstraints extends Constraints { /// Useful for slivers that have [RenderBox] children. BoxConstraints asBoxConstraints({ double minExtent: 0.0, - double maxExtent: double.INFINITY, + double maxExtent: double.infinity, double crossAxisExtent, }) { crossAxisExtent ??= this.crossAxisExtent; diff --git a/packages/flutter/lib/src/rendering/table.dart b/packages/flutter/lib/src/rendering/table.dart index 239049b683..6dc20c4470 100644 --- a/packages/flutter/lib/src/rendering/table.dart +++ b/packages/flutter/lib/src/rendering/table.dart @@ -97,7 +97,7 @@ class IntrinsicColumnWidth extends TableColumnWidth { double minIntrinsicWidth(Iterable cells, double containerWidth) { double result = 0.0; for (RenderBox cell in cells) - result = math.max(result, cell.getMinIntrinsicWidth(double.INFINITY)); + result = math.max(result, cell.getMinIntrinsicWidth(double.infinity)); return result; } @@ -105,7 +105,7 @@ class IntrinsicColumnWidth extends TableColumnWidth { double maxIntrinsicWidth(Iterable cells, double containerWidth) { double result = 0.0; for (RenderBox cell in cells) - result = math.max(result, cell.getMaxIntrinsicWidth(double.INFINITY)); + result = math.max(result, cell.getMaxIntrinsicWidth(double.infinity)); return result; } @@ -726,7 +726,7 @@ class RenderTable extends RenderBox { for (int x = 0; x < columns; x += 1) { final TableColumnWidth columnWidth = _columnWidths[x] ?? defaultColumnWidth; final Iterable columnCells = column(x); - totalMinWidth += columnWidth.minIntrinsicWidth(columnCells, double.INFINITY); + totalMinWidth += columnWidth.minIntrinsicWidth(columnCells, double.infinity); } return totalMinWidth; } @@ -738,7 +738,7 @@ class RenderTable extends RenderBox { for (int x = 0; x < columns; x += 1) { final TableColumnWidth columnWidth = _columnWidths[x] ?? defaultColumnWidth; final Iterable columnCells = column(x); - totalMaxWidth += columnWidth.maxIntrinsicWidth(columnCells, double.INFINITY); + totalMaxWidth += columnWidth.maxIntrinsicWidth(columnCells, double.infinity); } return totalMaxWidth; } diff --git a/packages/flutter/lib/src/rendering/wrap.dart b/packages/flutter/lib/src/rendering/wrap.dart index bfde2603cb..36a30482d5 100644 --- a/packages/flutter/lib/src/rendering/wrap.dart +++ b/packages/flutter/lib/src/rendering/wrap.dart @@ -390,7 +390,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin width) { height += runHeight; @@ -422,7 +422,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin height) { width += runWidth; @@ -452,7 +452,7 @@ class RenderWrap extends RenderBox with ContainerRenderObjectMixin 0) buffer.write('${timeStamp.inDays}d '); if (timeStamp.inHours > 0) - buffer.write('${timeStamp.inHours - timeStamp.inDays * Duration.HOURS_PER_DAY}h '); + buffer.write('${timeStamp.inHours - timeStamp.inDays * Duration.hoursPerDay}h '); if (timeStamp.inMinutes > 0) - buffer.write('${timeStamp.inMinutes - timeStamp.inHours * Duration.MINUTES_PER_HOUR}m '); + buffer.write('${timeStamp.inMinutes - timeStamp.inHours * Duration.minutesPerHour}m '); if (timeStamp.inSeconds > 0) - buffer.write('${timeStamp.inSeconds - timeStamp.inMinutes * Duration.SECONDS_PER_MINUTE}s '); - buffer.write('${timeStamp.inMilliseconds - timeStamp.inSeconds * Duration.MILLISECONDS_PER_SECOND}'); - final int microseconds = timeStamp.inMicroseconds - timeStamp.inMilliseconds * Duration.MICROSECONDS_PER_MILLISECOND; + buffer.write('${timeStamp.inSeconds - timeStamp.inMinutes * Duration.secondsPerMinute}s '); + buffer.write('${timeStamp.inMilliseconds - timeStamp.inSeconds * Duration.millisecondsPerSecond}'); + final int microseconds = timeStamp.inMicroseconds - timeStamp.inMilliseconds * Duration.microsecondsPerMillisecond; if (microseconds > 0) buffer.write('.${microseconds.toString().padLeft(3, "0")}'); buffer.write('ms'); diff --git a/packages/flutter/lib/src/services/asset_bundle.dart b/packages/flutter/lib/src/services/asset_bundle.dart index 9e88a708d9..87ea3d70dd 100644 --- a/packages/flutter/lib/src/services/asset_bundle.dart +++ b/packages/flutter/lib/src/services/asset_bundle.dart @@ -163,13 +163,13 @@ abstract class CachingAssetBundle extends AssetBundle { if (data.lengthInBytes < 10 * 1024) { // 10KB takes about 3ms to parse on a Pixel 2 XL. // See: https://github.com/dart-lang/sdk/issues/31954 - return UTF8.decode(data.buffer.asUint8List()); + return utf8.decode(data.buffer.asUint8List()); } return compute(_utf8decode, data, debugLabel: 'UTF8 decode for "$key"'); } static String _utf8decode(ByteData data) { - return UTF8.decode(data.buffer.asUint8List()); + return utf8.decode(data.buffer.asUint8List()); } /// Retrieve a string from the asset bundle, parse it with the given function, @@ -223,7 +223,7 @@ abstract class CachingAssetBundle extends AssetBundle { class PlatformAssetBundle extends CachingAssetBundle { @override Future load(String key) async { - final Uint8List encoded = UTF8.encoder.convert(new Uri(path: key).path); + final Uint8List encoded = utf8.encoder.convert(new Uri(path: key).path); final ByteData asset = await BinaryMessages.send('flutter/assets', encoded.buffer.asByteData()); if (asset == null) diff --git a/packages/flutter/lib/src/services/message_codecs.dart b/packages/flutter/lib/src/services/message_codecs.dart index 8c0f65b6b4..2fcf056a61 100644 --- a/packages/flutter/lib/src/services/message_codecs.dart +++ b/packages/flutter/lib/src/services/message_codecs.dart @@ -37,14 +37,14 @@ class StringCodec implements MessageCodec { String decodeMessage(ByteData message) { if (message == null) return null; - return UTF8.decoder.convert(message.buffer.asUint8List()); + return utf8.decoder.convert(message.buffer.asUint8List()); } @override ByteData encodeMessage(String message) { if (message == null) return null; - final Uint8List encoded = UTF8.encoder.convert(message); + final Uint8List encoded = utf8.encoder.convert(message); return encoded.buffer.asByteData(); } } @@ -79,14 +79,14 @@ class JSONMessageCodec implements MessageCodec { ByteData encodeMessage(dynamic message) { if (message == null) return null; - return const StringCodec().encodeMessage(JSON.encode(message)); + return const StringCodec().encodeMessage(json.encode(message)); } @override dynamic decodeMessage(ByteData message) { if (message == null) return message; - return JSON.decode(const StringCodec().decodeMessage(message)); + return json.decode(const StringCodec().decodeMessage(message)); } } @@ -308,7 +308,7 @@ class StandardMessageCodec implements MessageCodec { buffer.putFloat64(value); } else if (value is String) { buffer.putUint8(_kString); - final List bytes = UTF8.encoder.convert(value); + final List bytes = utf8.encoder.convert(value); _writeSize(buffer, bytes.length); buffer.putUint8List(bytes); } else if (value is Uint8List) { @@ -380,7 +380,7 @@ class StandardMessageCodec implements MessageCodec { // 2018-01-09 and will be made unavailable. // TODO(mravn): remove this case once the APIs are unavailable. final int length = _readSize(buffer); - final String hex = UTF8.decoder.convert(buffer.getUint8List(length)); + final String hex = utf8.decoder.convert(buffer.getUint8List(length)); result = int.parse(hex, radix: 16); break; case _kFloat64: @@ -388,7 +388,7 @@ class StandardMessageCodec implements MessageCodec { break; case _kString: final int length = _readSize(buffer); - result = UTF8.decoder.convert(buffer.getUint8List(length)); + result = utf8.decoder.convert(buffer.getUint8List(length)); break; case _kUint8List: final int length = _readSize(buffer); diff --git a/packages/flutter/lib/src/widgets/banner.dart b/packages/flutter/lib/src/widgets/banner.dart index db56e1c183..fed6fb67b8 100644 --- a/packages/flutter/lib/src/widgets/banner.dart +++ b/packages/flutter/lib/src/widgets/banner.dart @@ -204,20 +204,20 @@ class BannerPainter extends CustomPainter { switch (location) { case BannerLocation.bottomStart: case BannerLocation.topEnd: - return -math.PI / 4.0; + return -math.pi / 4.0; case BannerLocation.bottomEnd: case BannerLocation.topStart: - return math.PI / 4.0; + return math.pi / 4.0; } break; case TextDirection.ltr: switch (location) { case BannerLocation.bottomStart: case BannerLocation.topEnd: - return math.PI / 4.0; + return math.pi / 4.0; case BannerLocation.bottomEnd: case BannerLocation.topStart: - return -math.PI / 4.0; + return -math.pi / 4.0; } break; } diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index b0ccc640f5..331defc1b1 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -805,7 +805,7 @@ class PhysicalShape extends SingleChildRenderObjectWidget { /// color: Colors.black, /// child: new Transform( /// alignment: Alignment.topRight, -/// transform: new Matrix4.skewY(0.3)..rotateZ(-math.PI / 12.0), +/// transform: new Matrix4.skewY(0.3)..rotateZ(-math.pi / 12.0), /// child: new Container( /// padding: const EdgeInsets.all(8.0), /// color: const Color(0xFFE8581C), @@ -848,7 +848,7 @@ class Transform extends SingleChildRenderObjectWidget { /// /// ```dart /// new Transform.rotate( - /// angle: -math.PI / 12.0, + /// angle: -math.pi / 12.0, /// child: new Container( /// padding: const EdgeInsets.all(8.0), /// color: const Color(0xFFE8581C), @@ -1549,7 +1549,7 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget { /// /// The [new SizedBox.expand] constructor can be used to make a [SizedBox] that /// sizes itself to fit the parent. It is equivalent to setting [width] and -/// [height] to [double.INFINITY]. +/// [height] to [double.infinity]. /// /// ## Sample code /// @@ -1586,8 +1586,8 @@ class SizedBox extends SingleChildRenderObjectWidget { /// Creates a box that will become as large as its parent allows. const SizedBox.expand({ Key key, Widget child }) - : width = double.INFINITY, - height = double.INFINITY, + : width = double.infinity, + height = double.infinity, super(key: key, child: child); /// Creates a box with the specified size. @@ -1620,7 +1620,7 @@ class SizedBox extends SingleChildRenderObjectWidget { @override String toStringShort() { - final String type = (width == double.INFINITY && height == double.INFINITY) ? + final String type = (width == double.infinity && height == double.infinity) ? '$runtimeType.expand' : '$runtimeType'; return key == null ? '$type' : '$type-$key'; } @@ -1628,7 +1628,7 @@ class SizedBox extends SingleChildRenderObjectWidget { @override void debugFillProperties(DiagnosticPropertiesBuilder description) { super.debugFillProperties(description); - final DiagnosticLevel level = (width == double.INFINITY && height == double.INFINITY) + final DiagnosticLevel level = (width == double.infinity && height == double.infinity) ? DiagnosticLevel.hidden : DiagnosticLevel.info; description.add(new DoubleProperty('width', width, defaultValue: null, level: level)); @@ -1905,8 +1905,8 @@ class LimitedBox extends SingleChildRenderObjectWidget { /// negative. const LimitedBox({ Key key, - this.maxWidth: double.INFINITY, - this.maxHeight: double.INFINITY, + this.maxWidth: double.infinity, + this.maxHeight: double.infinity, Widget child, }) : assert(maxWidth != null && maxWidth >= 0.0), assert(maxHeight != null && maxHeight >= 0.0), @@ -1938,8 +1938,8 @@ class LimitedBox extends SingleChildRenderObjectWidget { @override void debugFillProperties(DiagnosticPropertiesBuilder description) { super.debugFillProperties(description); - description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.INFINITY)); - description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.INFINITY)); + description.add(new DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity)); + description.add(new DoubleProperty('maxHeight', maxHeight, defaultValue: double.infinity)); } } diff --git a/packages/flutter/lib/src/widgets/nested_scroll_view.dart b/packages/flutter/lib/src/widgets/nested_scroll_view.dart index b8fe5385b3..da800eee13 100644 --- a/packages/flutter/lib/src/widgets/nested_scroll_view.dart +++ b/packages/flutter/lib/src/widgets/nested_scroll_view.dart @@ -971,9 +971,9 @@ class _NestedScrollPosition extends ScrollPosition implements ScrollActivityDele // One is if the physics allow it, via applyFullDragUpdate (see below). An // overscroll situation can also be forced, e.g. if the scroll position is // artificially set using the scroll controller. - final double min = delta < 0.0 ? -double.INFINITY : math.min(minScrollExtent, pixels); + final double min = delta < 0.0 ? -double.infinity : math.min(minScrollExtent, pixels); // The logic for max is equivalent but on the other side. - final double max = delta > 0.0 ? double.INFINITY : math.max(maxScrollExtent, pixels); + final double max = delta > 0.0 ? double.infinity : math.max(maxScrollExtent, pixels); final double oldPixels = pixels; final double newPixels = (pixels - delta).clamp(min, max); final double clampedDelta = newPixels - pixels; diff --git a/packages/flutter/lib/src/widgets/overscroll_indicator.dart b/packages/flutter/lib/src/widgets/overscroll_indicator.dart index 897eae9708..5bf44ae3bb 100644 --- a/packages/flutter/lib/src/widgets/overscroll_indicator.dart +++ b/packages/flutter/lib/src/widgets/overscroll_indicator.dart @@ -308,7 +308,7 @@ class _GlowController extends ChangeNotifier { static const Duration _pullTime = const Duration(milliseconds: 167); static const Duration _pullHoldTime = const Duration(milliseconds: 167); static const Duration _pullDecayTime = const Duration(milliseconds: 2000); - static final Duration _crossAxisHalfTime = new Duration(microseconds: (Duration.MICROSECONDS_PER_SECOND / 60.0).round()); + static final Duration _crossAxisHalfTime = new Duration(microseconds: (Duration.microsecondsPerSecond / 60.0).round()); static const double _maxOpacity = 0.5; static const double _pullOpacityGlowFactor = 0.8; @@ -479,7 +479,7 @@ class _GlowingOverscrollIndicatorPainter extends CustomPainter { /// The direction of the viewport. final AxisDirection axisDirection; - static const double piOver2 = math.PI / 2.0; + static const double piOver2 = math.pi / 2.0; void _paintSide(Canvas canvas, Size size, _GlowController controller, AxisDirection axisDirection, GrowthDirection growthDirection) { if (controller == null) diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart index 5d621c52e6..34be56e526 100644 --- a/packages/flutter/lib/src/widgets/routes.dart +++ b/packages/flutter/lib/src/widgets/routes.dart @@ -107,7 +107,7 @@ abstract class TransitionRoute extends OverlayRoute { AnimationController createAnimationController() { assert(!_transitionCompleter.isCompleted, 'Cannot reuse a $runtimeType after disposing it.'); final Duration duration = transitionDuration; - assert(duration != null && duration >= Duration.ZERO); + assert(duration != null && duration >= Duration.zero); return new AnimationController( duration: duration, debugLabel: debugLabel, diff --git a/packages/flutter/lib/src/widgets/scroll_activity.dart b/packages/flutter/lib/src/widgets/scroll_activity.dart index 0e9b414de8..2f533f3e12 100644 --- a/packages/flutter/lib/src/widgets/scroll_activity.dart +++ b/packages/flutter/lib/src/widgets/scroll_activity.dart @@ -574,7 +574,7 @@ class DrivenScrollActivity extends ScrollActivity { }) : assert(from != null), assert(to != null), assert(duration != null), - assert(duration > Duration.ZERO), + assert(duration > Duration.zero), assert(curve != null), super(delegate) { _completer = new Completer(); diff --git a/packages/flutter/lib/src/widgets/scroll_position.dart b/packages/flutter/lib/src/widgets/scroll_position.dart index 4db5c5f371..a983fdcb44 100644 --- a/packages/flutter/lib/src/widgets/scroll_position.dart +++ b/packages/flutter/lib/src/widgets/scroll_position.dart @@ -459,7 +459,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { /// by just scrolling this position. Future ensureVisible(RenderObject object, { double alignment: 0.0, - Duration duration: Duration.ZERO, + Duration duration: Duration.zero, Curve curve: Curves.ease, }) { assert(object.attached); @@ -471,7 +471,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { if (target == pixels) return new Future.value(); - if (duration == Duration.ZERO) { + if (duration == Duration.zero) { jumpTo(target); return new Future.value(); } diff --git a/packages/flutter/lib/src/widgets/scroll_simulation.dart b/packages/flutter/lib/src/widgets/scroll_simulation.dart index e418b0162b..bc384b784e 100644 --- a/packages/flutter/lib/src/widgets/scroll_simulation.dart +++ b/packages/flutter/lib/src/widgets/scroll_simulation.dart @@ -44,10 +44,10 @@ class BouncingScrollSimulation extends Simulation { super(tolerance: tolerance) { if (position < leadingExtent) { _springSimulation = _underscrollSimulation(position, velocity); - _springTime = double.NEGATIVE_INFINITY; + _springTime = double.negativeInfinity; } else if (position > trailingExtent) { _springSimulation = _overscrollSimulation(position, velocity); - _springTime = double.NEGATIVE_INFINITY; + _springTime = double.negativeInfinity; } else { _frictionSimulation = new FrictionSimulation(0.135, position, velocity); final double finalX = _frictionSimulation.finalX; @@ -66,7 +66,7 @@ class BouncingScrollSimulation extends Simulation { ); assert(_springTime.isFinite); } else { - _springTime = double.INFINITY; + _springTime = double.infinity; } } assert(_springTime != null); diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index 2a34513ba1..802e353988 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -193,7 +193,7 @@ class Scrollable extends StatefulWidget { /// given context visible. static Future ensureVisible(BuildContext context, { double alignment: 0.0, - Duration duration: Duration.ZERO, + Duration duration: Duration.zero, Curve curve: Curves.ease, }) { final List> futures = >[]; @@ -210,7 +210,7 @@ class Scrollable extends StatefulWidget { scrollable = Scrollable.of(context); } - if (futures.isEmpty || duration == Duration.ZERO) + if (futures.isEmpty || duration == Duration.zero) return new Future.value(); if (futures.length == 1) return futures.single; diff --git a/packages/flutter/lib/src/widgets/sliver.dart b/packages/flutter/lib/src/widgets/sliver.dart index 4271080007..f5a047ff51 100644 --- a/packages/flutter/lib/src/widgets/sliver.dart +++ b/packages/flutter/lib/src/widgets/sliver.dart @@ -773,7 +773,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render ) { final int childCount = this.childCount; if (childCount == null) - return double.INFINITY; + return double.infinity; if (lastIndex == childCount - 1) return trailingScrollOffset; final int reifiedCount = lastIndex - firstIndex + 1; diff --git a/packages/flutter/lib/src/widgets/transitions.dart b/packages/flutter/lib/src/widgets/transitions.dart index c41f22a9a2..03971023be 100644 --- a/packages/flutter/lib/src/widgets/transitions.dart +++ b/packages/flutter/lib/src/widgets/transitions.dart @@ -236,7 +236,7 @@ class RotationTransition extends AnimatedWidget { @override Widget build(BuildContext context) { final double turnsValue = turns.value; - final Matrix4 transform = new Matrix4.rotationZ(turnsValue * math.PI * 2.0); + final Matrix4 transform = new Matrix4.rotationZ(turnsValue * math.pi * 2.0); return new Transform( transform: transform, alignment: Alignment.center, @@ -592,7 +592,7 @@ class AlignTransition extends AnimatedWidget { /// child: new Container(width: 200.0, height: 200.0, color: Colors.green), /// builder: (BuildContext context, Widget child) { /// return new Transform.rotate( -/// angle: _controller.value * 2.0 * math.PI, +/// angle: _controller.value * 2.0 * math.pi, /// child: child, /// ); /// }, diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index 9c1f9b31f2..dfca90e5af 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -334,7 +334,7 @@ class WidgetInspectorService { else throw new FlutterError('Cannot get parent chain for node of type ${value.runtimeType}'); - return JSON.encode(path.map((_DiagnosticsPathNode node) => _pathNodeToJson(node, groupName)).toList()); + return json.encode(path.map((_DiagnosticsPathNode node) => _pathNodeToJson(node, groupName)).toList()); } Map _pathNodeToJson(_DiagnosticsPathNode pathNode, String groupName) { @@ -393,7 +393,7 @@ class WidgetInspectorService { } String _serialize(DiagnosticsNode node, String groupName) { - return JSON.encode(_nodeToJson(node, groupName)); + return json.encode(_nodeToJson(node, groupName)); } List> _nodesToJson(Iterable nodes, String groupName) { @@ -406,14 +406,14 @@ class WidgetInspectorService { /// object that `diagnosticsNodeId` references. String getProperties(String diagnosticsNodeId, String groupName) { final DiagnosticsNode node = toObject(diagnosticsNodeId); - return JSON.encode(_nodesToJson(node == null ? const [] : node.getProperties(), groupName)); + return json.encode(_nodesToJson(node == null ? const [] : node.getProperties(), groupName)); } /// Returns a JSON representation of the children of the [DiagnosticsNode] /// object that `diagnosticsNodeId` references. String getChildren(String diagnosticsNodeId, String groupName) { final DiagnosticsNode node = toObject(diagnosticsNodeId); - return JSON.encode(_nodesToJson(node == null ? const [] : node.getChildren(), groupName)); + return json.encode(_nodesToJson(node == null ? const [] : node.getChildren(), groupName)); } /// Returns a JSON representation of the [DiagnosticsNode] for the root @@ -614,7 +614,7 @@ class _WidgetInspectorState extends State // Order matches by the size of the hit area. double _area(RenderObject object) { final Size size = object.semanticBounds?.size; - return size == null ? double.MAX_FINITE : size.width * size.height; + return size == null ? double.maxFinite : size.width * size.height; } regularHits.sort((RenderObject a, RenderObject b) => _area(a).compareTo(_area(b))); final Set hits = new LinkedHashSet(); @@ -823,7 +823,7 @@ class _RenderInspectorOverlay extends RenderBox { @override void performResize() { - size = constraints.constrain(const Size(double.INFINITY, double.INFINITY)); + size = constraints.constrain(const Size(double.infinity, double.infinity)); } @override diff --git a/packages/flutter/test/animation/animation_controller_test.dart b/packages/flutter/test/animation/animation_controller_test.dart index bc520ebaa6..fcb8ee6aaa 100644 --- a/packages/flutter/test/animation/animation_controller_test.dart +++ b/packages/flutter/test/animation/animation_controller_test.dart @@ -234,14 +234,14 @@ void main() { // edges controller.forward(); expect(controller.velocity, inInclusiveRange(0.4, 0.6)); - tick(Duration.ZERO); + tick(Duration.zero); expect(controller.velocity, inInclusiveRange(0.4, 0.6)); tick(const Duration(milliseconds: 5)); expect(controller.velocity, inInclusiveRange(0.9, 1.1)); controller.forward(from: 0.5); expect(controller.velocity, inInclusiveRange(0.4, 0.6)); - tick(Duration.ZERO); + tick(Duration.zero); expect(controller.velocity, inInclusiveRange(0.4, 0.6)); tick(const Duration(milliseconds: 5)); expect(controller.velocity, inInclusiveRange(0.9, 1.1)); @@ -249,13 +249,13 @@ void main() { // stopped controller.forward(from: 1.0); expect(controller.velocity, 0.0); - tick(Duration.ZERO); + tick(Duration.zero); expect(controller.velocity, 0.0); tick(const Duration(milliseconds: 500)); expect(controller.velocity, 0.0); controller.forward(); - tick(Duration.ZERO); + tick(Duration.zero); tick(const Duration(milliseconds: 1000)); expect(controller.velocity, 0.0); @@ -383,7 +383,7 @@ void main() { expect(controller.value, currentValue); }); - test('animateTo can deal with duration == Duration.ZERO', () { + test('animateTo can deal with duration == Duration.zero', () { final AnimationController controller = new AnimationController( duration: const Duration(milliseconds: 100), vsync: const TestVSync(), @@ -391,7 +391,7 @@ void main() { controller.forward(from: 0.2); expect(controller.value, 0.2); - controller.animateTo(1.0, duration: Duration.ZERO); + controller.animateTo(1.0, duration: Duration.zero); expect(SchedulerBinding.instance.transientCallbackCount, equals(0), reason: 'Expected no animation.'); expect(controller.value, 1.0); }); diff --git a/packages/flutter/test/engine/task_order_test.dart b/packages/flutter/test/engine/task_order_test.dart index a8985388e0..3ae150ed50 100644 --- a/packages/flutter/test/engine/task_order_test.dart +++ b/packages/flutter/test/engine/task_order_test.dart @@ -13,7 +13,7 @@ void main() { tasks.add(1); // Flush 0 microtasks. - await new Future.delayed(Duration.ZERO); + await new Future.delayed(Duration.zero); scheduleMicrotask(() { tasks.add(3); @@ -25,7 +25,7 @@ void main() { tasks.add(2); // Flush 2 microtasks. - await new Future.delayed(Duration.ZERO); + await new Future.delayed(Duration.zero); scheduleMicrotask(() { tasks.add(6); @@ -40,7 +40,7 @@ void main() { tasks.add(5); // Flush 3 microtasks. - await new Future.delayed(Duration.ZERO); + await new Future.delayed(Duration.zero); tasks.add(9); diff --git a/packages/flutter/test/foundation/diagnostics_test.dart b/packages/flutter/test/foundation/diagnostics_test.dart index 30d858d9df..4288ef1220 100644 --- a/packages/flutter/test/foundation/diagnostics_test.dart +++ b/packages/flutter/test/foundation/diagnostics_test.dart @@ -51,7 +51,7 @@ enum ExampleEnum { /// Encode and decode to JSON to make sure all objects in the JSON for the /// [DiagnosticsNode] are valid JSON. Map simulateJsonSerialization(DiagnosticsNode node) { - return JSON.decode(JSON.encode(node.toJsonMap())); + return json.decode(json.encode(node.toJsonMap())); } void validateNodeJsonSerialization(DiagnosticsNode node) { diff --git a/packages/flutter/test/foundation/serialization_test.dart b/packages/flutter/test/foundation/serialization_test.dart index cdb138012d..595ae19896 100644 --- a/packages/flutter/test/foundation/serialization_test.dart +++ b/packages/flutter/test/foundation/serialization_test.dart @@ -64,7 +64,7 @@ void main() { expect(read.getInt64List(3), equals(integers)); }); test('of double list when unaligned', () { - final Float64List doubles = new Float64List.fromList([3.14, double.NAN]); + final Float64List doubles = new Float64List.fromList([3.14, double.nan]); final WriteBuffer write = new WriteBuffer(); write.putUint8(9); write.putFloat64List(doubles); diff --git a/packages/flutter/test/foundation/service_extensions_test.dart b/packages/flutter/test/foundation/service_extensions_test.dart index 73ff6022a3..8833521765 100644 --- a/packages/flutter/test/foundation/service_extensions_test.dart +++ b/packages/flutter/test/foundation/service_extensions_test.dart @@ -56,7 +56,7 @@ class TestServiceExtensionsBinding extends BindingBase Future doFrame() async { frameScheduled = false; if (ui.window.onBeginFrame != null) - ui.window.onBeginFrame(Duration.ZERO); + ui.window.onBeginFrame(Duration.zero); await flushMicrotasks(); if (ui.window.onDrawFrame != null) ui.window.onDrawFrame(); @@ -303,7 +303,7 @@ void main() { completed = false; BinaryMessages.setMockMessageHandler('flutter/assets', (ByteData message) async { - expect(UTF8.decode(message.buffer.asUint8List()), 'test'); + expect(utf8.decode(message.buffer.asUint8List()), 'test'); completed = true; return new ByteData(5); // 0x0000000000 }); diff --git a/packages/flutter/test/material/date_picker_test.dart b/packages/flutter/test/material/date_picker_test.dart index 137907d790..c4eade58c4 100644 --- a/packages/flutter/test/material/date_picker_test.dart +++ b/packages/flutter/test/material/date_picker_test.dart @@ -26,16 +26,16 @@ void _tests() { final Finder previousMonthIcon = find.byWidgetPredicate((Widget w) => w is IconButton && (w.tooltip?.startsWith('Previous month') ?? false)); setUp(() { - firstDate = new DateTime(2001, DateTime.JANUARY, 1); - lastDate = new DateTime(2031, DateTime.DECEMBER, 31); - initialDate = new DateTime(2016, DateTime.JANUARY, 15); + firstDate = new DateTime(2001, DateTime.january, 1); + lastDate = new DateTime(2031, DateTime.december, 31); + initialDate = new DateTime(2016, DateTime.january, 15); selectableDayPredicate = null; initialDatePickerMode = null; }); testWidgets('tap-select a day', (WidgetTester tester) async { final Key _datePickerKey = new UniqueKey(); - DateTime _selectedDate = new DateTime(2016, DateTime.JULY, 26); + DateTime _selectedDate = new DateTime(2016, DateTime.july, 26); await tester.pumpWidget( new MaterialApp( @@ -64,7 +64,7 @@ void _tests() { ) ); - expect(_selectedDate, equals(new DateTime(2016, DateTime.JULY, 26))); + expect(_selectedDate, equals(new DateTime(2016, DateTime.july, 26))); await tester.tapAt(const Offset(50.0, 100.0)); await tester.pumpAndSettle(); @@ -72,31 +72,31 @@ void _tests() { await tester.tap(find.text('1')); await tester.pumpAndSettle(); - expect(_selectedDate, equals(new DateTime(2016, DateTime.JULY, 1))); + expect(_selectedDate, equals(new DateTime(2016, DateTime.july, 1))); await tester.tap(nextMonthIcon); await tester.pumpAndSettle(); - expect(_selectedDate, equals(new DateTime(2016, DateTime.JULY, 1))); + expect(_selectedDate, equals(new DateTime(2016, DateTime.july, 1))); await tester.tap(find.text('5')); await tester.pumpAndSettle(); - expect(_selectedDate, equals(new DateTime(2016, DateTime.AUGUST, 5))); + expect(_selectedDate, equals(new DateTime(2016, DateTime.august, 5))); await tester.drag(find.byKey(_datePickerKey), const Offset(-400.0, 0.0)); await tester.pumpAndSettle(); - expect(_selectedDate, equals(new DateTime(2016, DateTime.AUGUST, 5))); + expect(_selectedDate, equals(new DateTime(2016, DateTime.august, 5))); await tester.tap(find.text('25')); await tester.pumpAndSettle(); - expect(_selectedDate, equals(new DateTime(2016, DateTime.SEPTEMBER, 25))); + expect(_selectedDate, equals(new DateTime(2016, DateTime.september, 25))); await tester.drag(find.byKey(_datePickerKey), const Offset(800.0, 0.0)); await tester.pumpAndSettle(); - expect(_selectedDate, equals(new DateTime(2016, DateTime.SEPTEMBER, 25))); + expect(_selectedDate, equals(new DateTime(2016, DateTime.september, 25))); await tester.tap(find.text('17')); await tester.pumpAndSettle(); - expect(_selectedDate, equals(new DateTime(2016, DateTime.AUGUST, 17))); + expect(_selectedDate, equals(new DateTime(2016, DateTime.august, 17))); }); testWidgets('render picker with intrinsic dimensions', (WidgetTester tester) async { @@ -112,7 +112,7 @@ void _tests() { firstDate: new DateTime(0), lastDate: new DateTime(9999), onChanged: (DateTime value) { }, - selectedDate: new DateTime(2000, DateTime.JANUARY, 1), + selectedDate: new DateTime(2000, DateTime.january, 1), ), ), ), @@ -172,7 +172,7 @@ void _tests() { testWidgets('Initial date is the default', (WidgetTester tester) async { await preparePicker(tester, (Future date) async { await tester.tap(find.text('OK')); - expect(await date, equals(new DateTime(2016, DateTime.JANUARY, 15))); + expect(await date, equals(new DateTime(2016, DateTime.january, 15))); }); }); @@ -187,7 +187,7 @@ void _tests() { await preparePicker(tester, (Future date) async { await tester.tap(find.text('12')); await tester.tap(find.text('OK')); - expect(await date, equals(new DateTime(2016, DateTime.JANUARY, 12))); + expect(await date, equals(new DateTime(2016, DateTime.january, 12))); }); }); @@ -197,7 +197,7 @@ void _tests() { await tester.pumpAndSettle(const Duration(seconds: 1)); await tester.tap(find.text('25')); await tester.tap(find.text('OK')); - expect(await date, equals(new DateTime(2015, DateTime.DECEMBER, 25))); + expect(await date, equals(new DateTime(2015, DateTime.december, 25))); }); }); @@ -207,7 +207,7 @@ void _tests() { await tester.pump(); await tester.tap(find.text('2018')); await tester.tap(find.text('OK')); - expect(await date, equals(new DateTime(2018, DateTime.JANUARY, 15))); + expect(await date, equals(new DateTime(2018, DateTime.january, 15))); }); }); @@ -220,12 +220,12 @@ void _tests() { final MaterialLocalizations localizations = MaterialLocalizations.of( tester.element(find.byType(DayPicker)) ); - final String dayLabel = localizations.formatMediumDate(new DateTime(2017, DateTime.JANUARY, 15)); + final String dayLabel = localizations.formatMediumDate(new DateTime(2017, DateTime.january, 15)); await tester.tap(find.text(dayLabel)); await tester.pump(); await tester.tap(find.text('19')); await tester.tap(find.text('OK')); - expect(await date, equals(new DateTime(2017, DateTime.JANUARY, 19))); + expect(await date, equals(new DateTime(2017, DateTime.january, 19))); }); }); @@ -241,7 +241,7 @@ void _tests() { }); testWidgets('Cannot select a day outside bounds', (WidgetTester tester) async { - initialDate = new DateTime(2017, DateTime.JANUARY, 15); + initialDate = new DateTime(2017, DateTime.january, 15); firstDate = initialDate; lastDate = initialDate; await preparePicker(tester, (Future date) async { @@ -254,9 +254,9 @@ void _tests() { }); testWidgets('Cannot select a month past last date', (WidgetTester tester) async { - initialDate = new DateTime(2017, DateTime.JANUARY, 15); + initialDate = new DateTime(2017, DateTime.january, 15); firstDate = initialDate; - lastDate = new DateTime(2017, DateTime.FEBRUARY, 20); + lastDate = new DateTime(2017, DateTime.february, 20); await preparePicker(tester, (Future date) async { await tester.tap(nextMonthIcon); await tester.pumpAndSettle(const Duration(seconds: 1)); @@ -266,8 +266,8 @@ void _tests() { }); testWidgets('Cannot select a month before first date', (WidgetTester tester) async { - initialDate = new DateTime(2017, DateTime.JANUARY, 15); - firstDate = new DateTime(2016, DateTime.DECEMBER, 10); + initialDate = new DateTime(2017, DateTime.january, 15); + firstDate = new DateTime(2016, DateTime.december, 10); lastDate = initialDate; await preparePicker(tester, (Future date) async { await tester.tap(previousMonthIcon); @@ -278,21 +278,21 @@ void _tests() { }); testWidgets('Only predicate days are selectable', (WidgetTester tester) async { - initialDate = new DateTime(2017, DateTime.JANUARY, 16); - firstDate = new DateTime(2017, DateTime.JANUARY, 10); - lastDate = new DateTime(2017, DateTime.JANUARY, 20); + initialDate = new DateTime(2017, DateTime.january, 16); + firstDate = new DateTime(2017, DateTime.january, 10); + lastDate = new DateTime(2017, DateTime.january, 20); selectableDayPredicate = (DateTime day) => day.day.isEven; await preparePicker(tester, (Future date) async { await tester.tap(find.text('10')); // Even, works. await tester.tap(find.text('13')); // Odd, doesn't work. await tester.tap(find.text('17')); // Odd, doesn't work. await tester.tap(find.text('OK')); - expect(await date, equals(new DateTime(2017, DateTime.JANUARY, 10))); + expect(await date, equals(new DateTime(2017, DateTime.january, 10))); }); }); testWidgets('Can select initial date picker mode', (WidgetTester tester) async { - initialDate = new DateTime(2014, DateTime.JANUARY, 15); + initialDate = new DateTime(2014, DateTime.january, 15); initialDatePickerMode = DatePickerMode.year; await preparePicker(tester, (Future date) async { await tester.pump(); @@ -300,7 +300,7 @@ void _tests() { // The initial current year is 2014. await tester.tap(find.text('2018')); await tester.tap(find.text('OK')); - expect(await date, equals(new DateTime(2018, DateTime.JANUARY, 15))); + expect(await date, equals(new DateTime(2018, DateTime.january, 15))); }); }); @@ -310,9 +310,9 @@ void _tests() { setUp(() { feedback = new FeedbackTester(); - initialDate = new DateTime(2017, DateTime.JANUARY, 16); - firstDate = new DateTime(2017, DateTime.JANUARY, 10); - lastDate = new DateTime(2018, DateTime.JANUARY, 20); + initialDate = new DateTime(2017, DateTime.january, 16); + firstDate = new DateTime(2017, DateTime.january, 10); + lastDate = new DateTime(2018, DateTime.january, 20); selectableDayPredicate = (DateTime date) => date.day.isEven; }); diff --git a/packages/flutter/test/material/floating_action_button_test.dart b/packages/flutter/test/material/floating_action_button_test.dart index b02d997da8..2ac0dee608 100644 --- a/packages/flutter/test/material/floating_action_button_test.dart +++ b/packages/flutter/test/material/floating_action_button_test.dart @@ -403,7 +403,7 @@ bool pathDoesNotContainCircle(Path path, Rect circleBounds) { assert(circleBounds.width == circleBounds.height); final double radius = circleBounds.width / 2.0; - for (double theta = 0.0; theta <= 2.0 * math.PI; theta += math.PI / 20.0) { + for (double theta = 0.0; theta <= 2.0 * math.pi; theta += math.pi / 20.0) { for (double i = 0.0; i < 1; i += 0.01) { final double x = i * radius * math.cos(theta); final double y = i * radius * math.sin(theta); diff --git a/packages/flutter/test/material/slider_test.dart b/packages/flutter/test/material/slider_test.dart index 7505b86b24..670f30134d 100644 --- a/packages/flutter/test/material/slider_test.dart +++ b/packages/flutter/test/material/slider_test.dart @@ -670,8 +670,8 @@ void main() { child: const Material( child: const Center( child: const OverflowBox( - maxWidth: double.INFINITY, - maxHeight: double.INFINITY, + maxWidth: double.infinity, + maxHeight: double.infinity, child: const Slider( value: 0.5, onChanged: null, @@ -706,8 +706,8 @@ void main() { ), child: new Center( child: new OverflowBox( - maxWidth: double.INFINITY, - maxHeight: double.INFINITY, + maxWidth: double.infinity, + maxHeight: double.infinity, child: new Slider( key: sliderKey, min: 0.0, diff --git a/packages/flutter/test/physics/friction_simulation_test.dart b/packages/flutter/test/physics/friction_simulation_test.dart index c3ce9fe179..6bd003f55b 100644 --- a/packages/flutter/test/physics/friction_simulation_test.dart +++ b/packages/flutter/test/physics/friction_simulation_test.dart @@ -25,8 +25,8 @@ void main() { expect(friction.timeAtX(friction.x(0.5)), closeTo(0.5, _kEpsilon)); expect(friction.timeAtX(friction.x(2.0)), closeTo(2.0, _kEpsilon)); - expect(friction.timeAtX(-1.0), double.INFINITY); - expect(friction.timeAtX(200.0), double.INFINITY); + expect(friction.timeAtX(-1.0), double.infinity); + expect(friction.timeAtX(200.0), double.infinity); }); test('Friction simulation negative velocity', () { @@ -46,7 +46,7 @@ void main() { expect(friction.timeAtX(friction.x(0.5)), closeTo(0.5, _kEpsilon)); expect(friction.timeAtX(friction.x(2.0)), closeTo(2.0, _kEpsilon)); - expect(friction.timeAtX(101.0), double.INFINITY); - expect(friction.timeAtX(40.0), double.INFINITY); + expect(friction.timeAtX(101.0), double.infinity); + expect(friction.timeAtX(40.0), double.infinity); }); } diff --git a/packages/flutter/test/physics/newton_test.dart b/packages/flutter/test/physics/newton_test.dart index 4eed86deda..3055bb8d5a 100644 --- a/packages/flutter/test/physics/newton_test.dart +++ b/packages/flutter/test/physics/newton_test.dart @@ -239,7 +239,7 @@ void main() { position: 100.0, velocity: 400.0, leadingExtent: 0.0, - trailingExtent: double.INFINITY, + trailingExtent: double.infinity, spring: spring, ); scroll.tolerance = const Tolerance(velocity: 1.0); diff --git a/packages/flutter/test/rendering/aspect_ratio_test.dart b/packages/flutter/test/rendering/aspect_ratio_test.dart index 625a5a8646..66b878b43e 100644 --- a/packages/flutter/test/rendering/aspect_ratio_test.dart +++ b/packages/flutter/test/rendering/aspect_ratio_test.dart @@ -23,10 +23,10 @@ void main() { expect(box.getMaxIntrinsicHeight(200.0), 100.0); expect(box.getMaxIntrinsicHeight(400.0), 200.0); - expect(box.getMinIntrinsicWidth(double.INFINITY), 0.0); - expect(box.getMaxIntrinsicWidth(double.INFINITY), 0.0); - expect(box.getMinIntrinsicHeight(double.INFINITY), 0.0); - expect(box.getMaxIntrinsicHeight(double.INFINITY), 0.0); + expect(box.getMinIntrinsicWidth(double.infinity), 0.0); + expect(box.getMaxIntrinsicWidth(double.infinity), 0.0); + expect(box.getMinIntrinsicHeight(double.infinity), 0.0); + expect(box.getMaxIntrinsicHeight(double.infinity), 0.0); }); test('RenderAspectRatio: Intrinsic sizing 0.5', () { @@ -44,10 +44,10 @@ void main() { expect(box.getMaxIntrinsicHeight(200.0), 400.0); expect(box.getMaxIntrinsicHeight(400.0), 800.0); - expect(box.getMinIntrinsicWidth(double.INFINITY), 0.0); - expect(box.getMaxIntrinsicWidth(double.INFINITY), 0.0); - expect(box.getMinIntrinsicHeight(double.INFINITY), 0.0); - expect(box.getMaxIntrinsicHeight(double.INFINITY), 0.0); + expect(box.getMinIntrinsicWidth(double.infinity), 0.0); + expect(box.getMaxIntrinsicWidth(double.infinity), 0.0); + expect(box.getMinIntrinsicHeight(double.infinity), 0.0); + expect(box.getMaxIntrinsicHeight(double.infinity), 0.0); }); test('RenderAspectRatio: Intrinsic sizing 2.0', () { @@ -68,10 +68,10 @@ void main() { expect(box.getMaxIntrinsicHeight(200.0), 100.0); expect(box.getMaxIntrinsicHeight(400.0), 200.0); - expect(box.getMinIntrinsicWidth(double.INFINITY), 90.0); - expect(box.getMaxIntrinsicWidth(double.INFINITY), 90.0); - expect(box.getMinIntrinsicHeight(double.INFINITY), 70.0); - expect(box.getMaxIntrinsicHeight(double.INFINITY), 70.0); + expect(box.getMinIntrinsicWidth(double.infinity), 90.0); + expect(box.getMaxIntrinsicWidth(double.infinity), 90.0); + expect(box.getMinIntrinsicHeight(double.infinity), 70.0); + expect(box.getMaxIntrinsicHeight(double.infinity), 70.0); }); test('RenderAspectRatio: Intrinsic sizing 0.5', () { @@ -92,10 +92,10 @@ void main() { expect(box.getMaxIntrinsicHeight(200.0), 400.0); expect(box.getMaxIntrinsicHeight(400.0), 800.0); - expect(box.getMinIntrinsicWidth(double.INFINITY), 90.0); - expect(box.getMaxIntrinsicWidth(double.INFINITY), 90.0); - expect(box.getMinIntrinsicHeight(double.INFINITY), 70.0); - expect(box.getMaxIntrinsicHeight(double.INFINITY), 70.0); + expect(box.getMinIntrinsicWidth(double.infinity), 90.0); + expect(box.getMaxIntrinsicWidth(double.infinity), 90.0); + expect(box.getMinIntrinsicHeight(double.infinity), 70.0); + expect(box.getMaxIntrinsicHeight(double.infinity), 70.0); }); test('RenderAspectRatio: Unbounded', () { @@ -105,8 +105,8 @@ void main() { hadError = true; }; final RenderBox box = new RenderConstrainedOverflowBox( - maxWidth: double.INFINITY, - maxHeight: double.INFINITY, + maxWidth: double.infinity, + maxHeight: double.infinity, child: new RenderAspectRatio( aspectRatio: 0.5, child: new RenderSizedBox(const Size(90.0, 70.0)) @@ -139,13 +139,13 @@ void main() { pumpFrame(); expect(inside.size, const Size(90.0, 90.0)); - outside.maxWidth = double.INFINITY; + outside.maxWidth = double.infinity; outside.maxHeight = 90.0; pumpFrame(); expect(inside.size, const Size(90.0, 90.0)); outside.maxWidth = 90.0; - outside.maxHeight = double.INFINITY; + outside.maxHeight = double.infinity; pumpFrame(); expect(inside.size, const Size(90.0, 90.0)); @@ -161,13 +161,13 @@ void main() { pumpFrame(); expect(inside.size, const Size(90.0, 45.0)); - outside.maxWidth = double.INFINITY; + outside.maxWidth = double.infinity; outside.maxHeight = 90.0; pumpFrame(); expect(inside.size, const Size(180.0, 90.0)); outside.maxWidth = 90.0; - outside.maxHeight = double.INFINITY; + outside.maxHeight = double.infinity; pumpFrame(); expect(inside.size, const Size(90.0, 45.0)); @@ -184,13 +184,13 @@ void main() { pumpFrame(); expect(inside.size, const Size(90.0, 80.0)); - outside.maxWidth = double.INFINITY; + outside.maxWidth = double.infinity; outside.maxHeight = 90.0; pumpFrame(); expect(inside.size, const Size(180.0, 90.0)); outside.maxWidth = 90.0; - outside.maxHeight = double.INFINITY; + outside.maxHeight = double.infinity; pumpFrame(); expect(inside.size, const Size(90.0, 80.0)); }); diff --git a/packages/flutter/test/rendering/box_constraints_test.dart b/packages/flutter/test/rendering/box_constraints_test.dart index aaa807320b..51c50a6f6b 100644 --- a/packages/flutter/test/rendering/box_constraints_test.dart +++ b/packages/flutter/test/rendering/box_constraints_test.dart @@ -92,20 +92,20 @@ void main() { test('BoxConstraints lerp with unbounded width', () { const BoxConstraints constraints1 = const BoxConstraints( - minWidth: double.INFINITY, - maxWidth: double.INFINITY, + minWidth: double.infinity, + maxWidth: double.infinity, minHeight: 10.0, maxHeight: 20.0, ); const BoxConstraints constraints2 = const BoxConstraints( - minWidth: double.INFINITY, - maxWidth: double.INFINITY, + minWidth: double.infinity, + maxWidth: double.infinity, minHeight: 20.0, maxHeight: 30.0, ); const BoxConstraints constraints3 = const BoxConstraints( - minWidth: double.INFINITY, - maxWidth: double.INFINITY, + minWidth: double.infinity, + maxWidth: double.infinity, minHeight: 15.0, maxHeight: 25.0, ); @@ -116,40 +116,40 @@ void main() { const BoxConstraints constraints1 = const BoxConstraints( minWidth: 10.0, maxWidth: 20.0, - minHeight: double.INFINITY, - maxHeight: double.INFINITY, + minHeight: double.infinity, + maxHeight: double.infinity, ); const BoxConstraints constraints2 = const BoxConstraints( minWidth: 20.0, maxWidth: 30.0, - minHeight: double.INFINITY, - maxHeight: double.INFINITY, + minHeight: double.infinity, + maxHeight: double.infinity, ); const BoxConstraints constraints3 = const BoxConstraints( minWidth: 15.0, maxWidth: 25.0, - minHeight: double.INFINITY, - maxHeight: double.INFINITY, + minHeight: double.infinity, + maxHeight: double.infinity, ); expect(BoxConstraints.lerp(constraints1, constraints2, 0.5), constraints3); }); test('BoxConstraints lerp from bounded to unbounded', () { const BoxConstraints constraints1 = const BoxConstraints( - minWidth: double.INFINITY, - maxWidth: double.INFINITY, - minHeight: double.INFINITY, - maxHeight: double.INFINITY, + minWidth: double.infinity, + maxWidth: double.infinity, + minHeight: double.infinity, + maxHeight: double.infinity, ); const BoxConstraints constraints2 = const BoxConstraints( minWidth: 20.0, maxWidth: 30.0, - minHeight: double.INFINITY, - maxHeight: double.INFINITY, + minHeight: double.infinity, + maxHeight: double.infinity, ); const BoxConstraints constraints3 = const BoxConstraints( - minWidth: double.INFINITY, - maxWidth: double.INFINITY, + minWidth: double.infinity, + maxWidth: double.infinity, minHeight: 20.0, maxHeight: 30.0, ); diff --git a/packages/flutter/test/rendering/constraints_test.dart b/packages/flutter/test/rendering/constraints_test.dart index f355125178..0f1f131672 100644 --- a/packages/flutter/test/rendering/constraints_test.dart +++ b/packages/flutter/test/rendering/constraints_test.dart @@ -36,7 +36,7 @@ void main() { result = 'no exception'; try { - const BoxConstraints constraints = const BoxConstraints(minWidth: double.NAN, maxWidth: double.NAN, minHeight: 2.0, maxHeight: double.NAN); + const BoxConstraints constraints = const BoxConstraints(minWidth: double.nan, maxWidth: double.nan, minHeight: 2.0, maxHeight: double.nan); assert(constraints.debugAssertIsValid()); } on FlutterError catch (e) { result = '$e'; @@ -49,7 +49,7 @@ void main() { result = 'no exception'; try { - const BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN); + const BoxConstraints constraints = const BoxConstraints(minHeight: double.nan); assert(constraints.debugAssertIsValid()); } on FlutterError catch (e) { result = '$e'; @@ -62,7 +62,7 @@ void main() { result = 'no exception'; try { - const BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN, maxWidth: 0.0/0.0); + const BoxConstraints constraints = const BoxConstraints(minHeight: double.nan, maxWidth: 0.0/0.0); assert(constraints.debugAssertIsValid()); } on FlutterError catch (e) { result = '$e'; diff --git a/packages/flutter/test/rendering/dynamic_intrinsics_test.dart b/packages/flutter/test/rendering/dynamic_intrinsics_test.dart index 5eac2397e5..b976ec49b8 100644 --- a/packages/flutter/test/rendering/dynamic_intrinsics_test.dart +++ b/packages/flutter/test/rendering/dynamic_intrinsics_test.dart @@ -50,8 +50,8 @@ class RenderIntrinsicSize extends RenderProxyBox { void performLayout() { child.layout(constraints); size = new Size( - child.getMinIntrinsicWidth(double.INFINITY), - child.getMinIntrinsicHeight(double.INFINITY) + child.getMinIntrinsicWidth(double.infinity), + child.getMinIntrinsicHeight(double.infinity) ); } } diff --git a/packages/flutter/test/rendering/editable_test.dart b/packages/flutter/test/rendering/editable_test.dart index 85cf906d7a..5f0d8ca629 100644 --- a/packages/flutter/test/rendering/editable_test.dart +++ b/packages/flutter/test/rendering/editable_test.dart @@ -16,10 +16,10 @@ void main() { textDirection: TextDirection.ltr, offset: new ViewportOffset.zero(), ); - expect(editable.getMinIntrinsicWidth(double.INFINITY), 50.0); - expect(editable.getMaxIntrinsicWidth(double.INFINITY), 50.0); - expect(editable.getMinIntrinsicHeight(double.INFINITY), 10.0); - expect(editable.getMaxIntrinsicHeight(double.INFINITY), 10.0); + expect(editable.getMinIntrinsicWidth(double.infinity), 50.0); + expect(editable.getMaxIntrinsicWidth(double.infinity), 50.0); + expect(editable.getMinIntrinsicHeight(double.infinity), 10.0); + expect(editable.getMaxIntrinsicHeight(double.infinity), 10.0); expect( editable.toStringDeep(minLevel: DiagnosticLevel.info), diff --git a/packages/flutter/test/rendering/flex_test.dart b/packages/flutter/test/rendering/flex_test.dart index fd5ad3e0da..42575b285f 100644 --- a/packages/flutter/test/rendering/flex_test.dart +++ b/packages/flutter/test/rendering/flex_test.dart @@ -302,7 +302,7 @@ void main() { ); final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox( minWidth: 0.0, - maxWidth: double.INFINITY, + maxWidth: double.infinity, minHeight: 0.0, maxHeight: 400.0, child: flex, @@ -347,7 +347,7 @@ void main() { ); final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox( minWidth: 0.0, - maxWidth: double.INFINITY, + maxWidth: double.infinity, minHeight: 0.0, maxHeight: 400.0, child: flex, @@ -376,7 +376,7 @@ void main() { ); final RenderConstrainedOverflowBox parent = new RenderConstrainedOverflowBox( minWidth: 0.0, - maxWidth: double.INFINITY, + maxWidth: double.infinity, minHeight: 0.0, maxHeight: 400.0, child: flex, diff --git a/packages/flutter/test/rendering/intrinsic_width_test.dart b/packages/flutter/test/rendering/intrinsic_width_test.dart index aa4ea0a230..9648d2c516 100644 --- a/packages/flutter/test/rendering/intrinsic_width_test.dart +++ b/packages/flutter/test/rendering/intrinsic_width_test.dart @@ -73,10 +73,10 @@ void main() { expect(parent.getMinIntrinsicHeight(80.0), equals(20.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0)); - expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(100.0)); - expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(100.0)); - expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(20.0)); - expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(200.0)); + expect(parent.getMinIntrinsicWidth(double.infinity), equals(100.0)); + expect(parent.getMaxIntrinsicWidth(double.infinity), equals(100.0)); + expect(parent.getMinIntrinsicHeight(double.infinity), equals(20.0)); + expect(parent.getMaxIntrinsicHeight(double.infinity), equals(200.0)); }); test('IntrinsicWidth without a child', () { @@ -107,10 +107,10 @@ void main() { expect(parent.getMinIntrinsicHeight(80.0), equals(0.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(0.0)); - expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(0.0)); - expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(0.0)); - expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(0.0)); - expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(0.0)); + expect(parent.getMinIntrinsicWidth(double.infinity), equals(0.0)); + expect(parent.getMaxIntrinsicWidth(double.infinity), equals(0.0)); + expect(parent.getMinIntrinsicHeight(double.infinity), equals(0.0)); + expect(parent.getMaxIntrinsicHeight(double.infinity), equals(0.0)); }); test('Shrink-wrapping width (stepped width)', () { @@ -142,10 +142,10 @@ void main() { expect(parent.getMinIntrinsicHeight(80.0), equals(20.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0)); - expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(3.0 * 47.0)); - expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(3.0 * 47.0)); - expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(20.0)); - expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(200.0)); + expect(parent.getMinIntrinsicWidth(double.infinity), equals(3.0 * 47.0)); + expect(parent.getMaxIntrinsicWidth(double.infinity), equals(3.0 * 47.0)); + expect(parent.getMinIntrinsicHeight(double.infinity), equals(20.0)); + expect(parent.getMaxIntrinsicHeight(double.infinity), equals(200.0)); }); test('Shrink-wrapping width (stepped height)', () { @@ -177,10 +177,10 @@ void main() { expect(parent.getMinIntrinsicHeight(80.0), equals(1.0 * 47.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(5.0 * 47.0)); - expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(100.0)); - expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(100.0)); - expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(1.0 * 47.0)); - expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(5.0 * 47.0)); + expect(parent.getMinIntrinsicWidth(double.infinity), equals(100.0)); + expect(parent.getMaxIntrinsicWidth(double.infinity), equals(100.0)); + expect(parent.getMinIntrinsicHeight(double.infinity), equals(1.0 * 47.0)); + expect(parent.getMaxIntrinsicHeight(double.infinity), equals(5.0 * 47.0)); }); test('Shrink-wrapping width (stepped everything)', () { @@ -212,10 +212,10 @@ void main() { expect(parent.getMinIntrinsicHeight(80.0), equals(1.0 * 47.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(5.0 * 47.0)); - expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(3.0 * 37.0)); - expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(3.0 * 37.0)); - expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(1.0 * 47.0)); - expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(5.0 * 47.0)); + expect(parent.getMinIntrinsicWidth(double.infinity), equals(3.0 * 37.0)); + expect(parent.getMaxIntrinsicWidth(double.infinity), equals(3.0 * 37.0)); + expect(parent.getMinIntrinsicHeight(double.infinity), equals(1.0 * 47.0)); + expect(parent.getMaxIntrinsicHeight(double.infinity), equals(5.0 * 47.0)); }); test('Shrink-wrapping height', () { @@ -247,10 +247,10 @@ void main() { expect(parent.getMinIntrinsicHeight(80.0), equals(200.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(200.0)); - expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(10.0)); - expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(100.0)); - expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(200.0)); - expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(200.0)); + expect(parent.getMinIntrinsicWidth(double.infinity), equals(10.0)); + expect(parent.getMaxIntrinsicWidth(double.infinity), equals(100.0)); + expect(parent.getMinIntrinsicHeight(double.infinity), equals(200.0)); + expect(parent.getMaxIntrinsicHeight(double.infinity), equals(200.0)); }); test('IntrinsicHeight without a child', () { @@ -281,10 +281,10 @@ void main() { expect(parent.getMinIntrinsicHeight(80.0), equals(0.0)); expect(parent.getMaxIntrinsicHeight(80.0), equals(0.0)); - expect(parent.getMinIntrinsicWidth(double.INFINITY), equals(0.0)); - expect(parent.getMaxIntrinsicWidth(double.INFINITY), equals(0.0)); - expect(parent.getMinIntrinsicHeight(double.INFINITY), equals(0.0)); - expect(parent.getMaxIntrinsicHeight(double.INFINITY), equals(0.0)); + expect(parent.getMinIntrinsicWidth(double.infinity), equals(0.0)); + expect(parent.getMaxIntrinsicWidth(double.infinity), equals(0.0)); + expect(parent.getMinIntrinsicHeight(double.infinity), equals(0.0)); + expect(parent.getMaxIntrinsicHeight(double.infinity), equals(0.0)); }); test('Padding and boring intrinsics', () { @@ -308,10 +308,10 @@ void main() { expect(box.getMinIntrinsicHeight(80.0), 50.0); expect(box.getMaxIntrinsicHeight(80.0), 50.0); - expect(box.getMinIntrinsicWidth(double.INFINITY), 50.0); - expect(box.getMaxIntrinsicWidth(double.INFINITY), 50.0); - expect(box.getMinIntrinsicHeight(double.INFINITY), 50.0); - expect(box.getMaxIntrinsicHeight(double.INFINITY), 50.0); + expect(box.getMinIntrinsicWidth(double.infinity), 50.0); + expect(box.getMaxIntrinsicWidth(double.infinity), 50.0); + expect(box.getMinIntrinsicHeight(double.infinity), 50.0); + expect(box.getMaxIntrinsicHeight(double.infinity), 50.0); // also a smoke test: layout( @@ -346,10 +346,10 @@ void main() { expect(box.getMinIntrinsicHeight(80.0), 80.0); expect(box.getMaxIntrinsicHeight(80.0), 80.0); - expect(box.getMinIntrinsicWidth(double.INFINITY), 30.0); - expect(box.getMaxIntrinsicWidth(double.INFINITY), 30.0); - expect(box.getMinIntrinsicHeight(double.INFINITY), 30.0); - expect(box.getMaxIntrinsicHeight(double.INFINITY), 30.0); + expect(box.getMinIntrinsicWidth(double.infinity), 30.0); + expect(box.getMaxIntrinsicWidth(double.infinity), 30.0); + expect(box.getMinIntrinsicHeight(double.infinity), 30.0); + expect(box.getMaxIntrinsicHeight(double.infinity), 30.0); // also a smoke test: layout( @@ -384,10 +384,10 @@ void main() { expect(box.getMinIntrinsicHeight(80.0), 50.0); expect(box.getMaxIntrinsicHeight(80.0), 50.0); - expect(box.getMinIntrinsicWidth(double.INFINITY), 50.0); - expect(box.getMaxIntrinsicWidth(double.INFINITY), 50.0); - expect(box.getMinIntrinsicHeight(double.INFINITY), 50.0); - expect(box.getMaxIntrinsicHeight(double.INFINITY), 50.0); + expect(box.getMinIntrinsicWidth(double.infinity), 50.0); + expect(box.getMaxIntrinsicWidth(double.infinity), 50.0); + expect(box.getMinIntrinsicHeight(double.infinity), 50.0); + expect(box.getMaxIntrinsicHeight(double.infinity), 50.0); // also a smoke test: layout( @@ -422,10 +422,10 @@ void main() { expect(box.getMinIntrinsicHeight(80.0), 80.0); expect(box.getMaxIntrinsicHeight(80.0), 80.0); - expect(box.getMinIntrinsicWidth(double.INFINITY), 30.0); - expect(box.getMaxIntrinsicWidth(double.INFINITY), 30.0); - expect(box.getMinIntrinsicHeight(double.INFINITY), 30.0); - expect(box.getMaxIntrinsicHeight(double.INFINITY), 30.0); + expect(box.getMinIntrinsicWidth(double.infinity), 30.0); + expect(box.getMaxIntrinsicWidth(double.infinity), 30.0); + expect(box.getMinIntrinsicHeight(double.infinity), 30.0); + expect(box.getMaxIntrinsicHeight(double.infinity), 30.0); // also a smoke test: layout( diff --git a/packages/flutter/test/rendering/limited_box_test.dart b/packages/flutter/test/rendering/limited_box_test.dart index c981a20cd9..7cfd4608ed 100644 --- a/packages/flutter/test/rendering/limited_box_test.dart +++ b/packages/flutter/test/rendering/limited_box_test.dart @@ -15,9 +15,9 @@ void main() { ); final RenderBox parent = new RenderConstrainedOverflowBox( minWidth: 0.0, - maxWidth: double.INFINITY, + maxWidth: double.infinity, minHeight: 0.0, - maxHeight: double.INFINITY, + maxHeight: double.infinity, child: new RenderLimitedBox( maxWidth: 100.0, maxHeight: 200.0, @@ -64,7 +64,7 @@ void main() { ); final RenderBox parent = new RenderConstrainedOverflowBox( minWidth: 0.0, - maxWidth: double.INFINITY, + maxWidth: double.infinity, minHeight: 500.0, maxHeight: 500.0, child: new RenderLimitedBox( @@ -86,7 +86,7 @@ void main() { minWidth: 500.0, maxWidth: 500.0, minHeight: 0.0, - maxHeight: double.INFINITY, + maxHeight: double.infinity, child: new RenderLimitedBox( maxWidth: 100.0, maxHeight: 200.0, @@ -105,7 +105,7 @@ void main() { minWidth: 10.0, maxWidth: 500.0, minHeight: 0.0, - maxHeight: double.INFINITY, + maxHeight: double.infinity, child: box = new RenderLimitedBox( maxWidth: 100.0, maxHeight: 200.0, diff --git a/packages/flutter/test/rendering/paragraph_intrinsics_test.dart b/packages/flutter/test/rendering/paragraph_intrinsics_test.dart index 75e9db92e8..15f39d554c 100644 --- a/packages/flutter/test/rendering/paragraph_intrinsics_test.dart +++ b/packages/flutter/test/rendering/paragraph_intrinsics_test.dart @@ -20,10 +20,10 @@ void main() { ], ); - final double textWidth = paragraph.getMaxIntrinsicWidth(double.INFINITY); - final double oneLineTextHeight = paragraph.getMinIntrinsicHeight(double.INFINITY); + final double textWidth = paragraph.getMaxIntrinsicWidth(double.infinity); + final double oneLineTextHeight = paragraph.getMinIntrinsicHeight(double.infinity); final double constrainedWidth = textWidth * 0.9; - final double wrappedTextWidth = paragraph.getMinIntrinsicWidth(double.INFINITY); + final double wrappedTextWidth = paragraph.getMinIntrinsicWidth(double.infinity); final double twoLinesTextHeight = paragraph.getMinIntrinsicHeight(constrainedWidth); final double manyLinesTextHeight = paragraph.getMinIntrinsicHeight(0.0); @@ -33,16 +33,16 @@ void main() { expect(oneLineTextHeight, lessThan(twoLinesTextHeight)); expect(twoLinesTextHeight, lessThan(oneLineTextHeight * 3.0)); expect(manyLinesTextHeight, greaterThan(twoLinesTextHeight)); - expect(paragraph.getMaxIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); + expect(paragraph.getMaxIntrinsicHeight(double.infinity), equals(oneLineTextHeight)); expect(paragraph.getMaxIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); expect(paragraph.getMaxIntrinsicHeight(0.0), equals(manyLinesTextHeight)); // vertical block (same expectations) - expect(testBlock.getMinIntrinsicWidth(double.INFINITY), equals(wrappedTextWidth)); - expect(testBlock.getMaxIntrinsicWidth(double.INFINITY), equals(textWidth)); - expect(testBlock.getMinIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); + expect(testBlock.getMinIntrinsicWidth(double.infinity), equals(wrappedTextWidth)); + expect(testBlock.getMaxIntrinsicWidth(double.infinity), equals(textWidth)); + expect(testBlock.getMinIntrinsicHeight(double.infinity), equals(oneLineTextHeight)); expect(testBlock.getMinIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); - expect(testBlock.getMaxIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); + expect(testBlock.getMaxIntrinsicHeight(double.infinity), equals(oneLineTextHeight)); expect(testBlock.getMaxIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); expect(testBlock.getMinIntrinsicWidth(0.0), equals(wrappedTextWidth)); expect(testBlock.getMaxIntrinsicWidth(0.0), equals(textWidth)); @@ -53,11 +53,11 @@ void main() { // horizontal block (same expectations again) testBlock.axisDirection = AxisDirection.right; - expect(testBlock.getMinIntrinsicWidth(double.INFINITY), equals(wrappedTextWidth)); - expect(testBlock.getMaxIntrinsicWidth(double.INFINITY), equals(textWidth)); - expect(testBlock.getMinIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); + expect(testBlock.getMinIntrinsicWidth(double.infinity), equals(wrappedTextWidth)); + expect(testBlock.getMaxIntrinsicWidth(double.infinity), equals(textWidth)); + expect(testBlock.getMinIntrinsicHeight(double.infinity), equals(oneLineTextHeight)); expect(testBlock.getMinIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); - expect(testBlock.getMaxIntrinsicHeight(double.INFINITY), equals(oneLineTextHeight)); + expect(testBlock.getMaxIntrinsicHeight(double.infinity), equals(oneLineTextHeight)); expect(testBlock.getMaxIntrinsicHeight(constrainedWidth), equals(twoLinesTextHeight)); expect(testBlock.getMinIntrinsicWidth(0.0), equals(wrappedTextWidth)); expect(testBlock.getMaxIntrinsicWidth(0.0), equals(textWidth)); diff --git a/packages/flutter/test/rendering/proxy_getters_and_setters_test.dart b/packages/flutter/test/rendering/proxy_getters_and_setters_test.dart index 07c4a7fbbd..65a4390782 100644 --- a/packages/flutter/test/rendering/proxy_getters_and_setters_test.dart +++ b/packages/flutter/test/rendering/proxy_getters_and_setters_test.dart @@ -16,8 +16,8 @@ void main() { test('RenderLimitedBox getters and setters', () { final RenderLimitedBox box = new RenderLimitedBox(); - expect(box.maxWidth, double.INFINITY); - expect(box.maxHeight, double.INFINITY); + expect(box.maxWidth, double.infinity); + expect(box.maxHeight, double.infinity); box.maxWidth = 0.0; box.maxHeight = 1.0; expect(box.maxHeight, 1.0); diff --git a/packages/flutter/test/rendering/transform_test.dart b/packages/flutter/test/rendering/transform_test.dart index 9d34601fea..f174438417 100644 --- a/packages/flutter/test/rendering/transform_test.dart +++ b/packages/flutter/test/rendering/transform_test.dart @@ -95,7 +95,7 @@ void main() { test('RenderTransform - rotation', () { RenderBox inner; final RenderBox sizer = new RenderTransform( - transform: new Matrix4.rotationZ(math.PI), + transform: new Matrix4.rotationZ(math.pi), alignment: Alignment.center, child: inner = new RenderSizedBox(const Size(100.0, 100.0)), ); @@ -113,7 +113,7 @@ void main() { test('RenderTransform - rotation with internal offset', () { RenderBox inner; final RenderBox sizer = new RenderTransform( - transform: new Matrix4.rotationZ(math.PI), + transform: new Matrix4.rotationZ(math.pi), alignment: Alignment.center, child: new RenderPadding( padding: const EdgeInsets.only(left: 20.0), @@ -134,7 +134,7 @@ void main() { test('RenderTransform - perspective - globalToLocal', () { RenderBox inner; final RenderBox sizer = new RenderTransform( - transform: rotateAroundXAxis(math.PI * 0.25), // at pi/4, we are about 70 pixels high + transform: rotateAroundXAxis(math.pi * 0.25), // at pi/4, we are about 70 pixels high alignment: Alignment.center, child: inner = new RenderSizedBox(const Size(100.0, 100.0)), ); @@ -151,7 +151,7 @@ void main() { test('RenderTransform - perspective - localToGlobal', () { RenderBox inner; final RenderBox sizer = new RenderTransform( - transform: rotateAroundXAxis(math.PI * 0.4999), // at pi/2, we're seeing the box on its edge, + transform: rotateAroundXAxis(math.pi * 0.4999), // at pi/2, we're seeing the box on its edge, alignment: Alignment.center, child: inner = new RenderSizedBox(const Size(100.0, 100.0)), ); diff --git a/packages/flutter/test/services/message_codecs_test.dart b/packages/flutter/test/services/message_codecs_test.dart index 33277f9f42..ec62747010 100644 --- a/packages/flutter/test/services/message_codecs_test.dart +++ b/packages/flutter/test/services/message_codecs_test.dart @@ -137,8 +137,8 @@ void main() { _checkEncodeDecode(standard, 9223372036854775807); _checkEncodeDecode(standard, -9223372036854775807); _checkEncodeDecode(standard, 3.14); - _checkEncodeDecode(standard, double.INFINITY); - _checkEncodeDecode(standard, double.NAN); + _checkEncodeDecode(standard, double.infinity); + _checkEncodeDecode(standard, double.nan); _checkEncodeDecode(standard, ''); _checkEncodeDecode(standard, 'hello'); _checkEncodeDecode(standard, 'special chars >\u263A\u{1F602}<'); @@ -161,15 +161,15 @@ void main() { [-0x7fffffffffffffff - 1, 0, 0x7fffffffffffffff]), null, // ensures the offset of the following list is unaligned. new Float64List.fromList([ - double.NEGATIVE_INFINITY, - -double.MAX_FINITE, - -double.MIN_POSITIVE, + double.negativeInfinity, + -double.maxFinite, + -double.minPositive, -0.0, 0.0, - double.MIN_POSITIVE, - double.MAX_FINITE, - double.INFINITY, - double.NAN + double.minPositive, + double.maxFinite, + double.infinity, + double.nan ]), ['nested', []], { 'a': 'nested', null: {} }, diff --git a/packages/flutter/test/services/platform_channel_test.dart b/packages/flutter/test/services/platform_channel_test.dart index 6bff8d3a2a..11e7845848 100644 --- a/packages/flutter/test/services/platform_channel_test.dart +++ b/packages/flutter/test/services/platform_channel_test.dart @@ -190,7 +190,7 @@ void main() { ); final List events = await channel.receiveBroadcastStream('hello').toList(); expect(events, orderedEquals(['hello1', 'hello2'])); - await new Future.delayed(Duration.ZERO); + await new Future.delayed(Duration.zero); expect(canceled, isTrue); }); test('can receive error event', () async { @@ -212,7 +212,7 @@ void main() { final List events = []; final List errors = []; channel.receiveBroadcastStream('hello').listen(events.add, onError: errors.add); - await new Future.delayed(Duration.ZERO); + await new Future.delayed(Duration.zero); expect(events, isEmpty); expect(errors, hasLength(1)); expect(errors[0], const isInstanceOf()); diff --git a/packages/flutter/test/widgets/async_test.dart b/packages/flutter/test/widgets/async_test.dart index 2be0516e5e..a0668fb6a0 100644 --- a/packages/flutter/test/widgets/async_test.dart +++ b/packages/flutter/test/widgets/async_test.dart @@ -328,7 +328,7 @@ void main() { } Future eventFiring(WidgetTester tester) async { - await tester.pump(Duration.ZERO); + await tester.pump(Duration.zero); } class StringCollector extends StreamBuilderBase> { diff --git a/packages/flutter/test/widgets/banner_test.dart b/packages/flutter/test/widgets/banner_test.dart index 1ab978725a..34834e9b35 100644 --- a/packages/flutter/test/widgets/banner_test.dart +++ b/packages/flutter/test/widgets/banner_test.dart @@ -48,7 +48,7 @@ void main() { }); expect(rotateCommand, isNotNull); - expect(rotateCommand.positionalArguments[0], equals(-math.PI / 4.0)); + expect(rotateCommand.positionalArguments[0], equals(-math.pi / 4.0)); }); test('A Banner with a location of topStart paints in the top right (RTL)', () { @@ -76,7 +76,7 @@ void main() { }); expect(rotateCommand, isNotNull); - expect(rotateCommand.positionalArguments[0], equals(math.PI / 4.0)); + expect(rotateCommand.positionalArguments[0], equals(math.pi / 4.0)); }); test('A Banner with a location of topEnd paints in the top right (LTR)', () { @@ -104,7 +104,7 @@ void main() { }); expect(rotateCommand, isNotNull); - expect(rotateCommand.positionalArguments[0], equals(math.PI / 4.0)); + expect(rotateCommand.positionalArguments[0], equals(math.pi / 4.0)); }); test('A Banner with a location of topEnd paints in the top left (RTL)', () { @@ -132,7 +132,7 @@ void main() { }); expect(rotateCommand, isNotNull); - expect(rotateCommand.positionalArguments[0], equals(-math.PI / 4.0)); + expect(rotateCommand.positionalArguments[0], equals(-math.pi / 4.0)); }); test('A Banner with a location of bottomStart paints in the bottom left (LTR)', () { @@ -160,7 +160,7 @@ void main() { }); expect(rotateCommand, isNotNull); - expect(rotateCommand.positionalArguments[0], equals(math.PI / 4.0)); + expect(rotateCommand.positionalArguments[0], equals(math.pi / 4.0)); }); test('A Banner with a location of bottomStart paints in the bottom right (RTL)', () { @@ -188,7 +188,7 @@ void main() { }); expect(rotateCommand, isNotNull); - expect(rotateCommand.positionalArguments[0], equals(-math.PI / 4.0)); + expect(rotateCommand.positionalArguments[0], equals(-math.pi / 4.0)); }); test('A Banner with a location of bottomEnd paints in the bottom right (LTR)', () { @@ -216,7 +216,7 @@ void main() { }); expect(rotateCommand, isNotNull); - expect(rotateCommand.positionalArguments[0], equals(-math.PI / 4.0)); + expect(rotateCommand.positionalArguments[0], equals(-math.pi / 4.0)); }); test('A Banner with a location of bottomEnd paints in the bottom left (RTL)', () { @@ -244,7 +244,7 @@ void main() { }); expect(rotateCommand, isNotNull); - expect(rotateCommand.positionalArguments[0], equals(math.PI / 4.0)); + expect(rotateCommand.positionalArguments[0], equals(math.pi / 4.0)); }); testWidgets('Banner widget', (WidgetTester tester) async { @@ -257,7 +257,7 @@ void main() { expect(find.byType(CustomPaint), paints ..save ..translate(x: 800.0, y: 0.0) - ..rotate(angle: math.PI / 4.0) + ..rotate(angle: math.pi / 4.0) ..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true) ..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false) ..paragraph(offset: const Offset(-40.0, 29.0)) @@ -270,7 +270,7 @@ void main() { expect(find.byType(CheckedModeBanner), paints ..save ..translate(x: 800.0, y: 0.0) - ..rotate(angle: math.PI / 4.0) + ..rotate(angle: math.pi / 4.0) ..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0x7f000000), hasMaskFilter: true) ..rect(rect: new Rect.fromLTRB(-40.0, 28.0, 40.0, 40.0), color: const Color(0xa0b71c1c), hasMaskFilter: false) ..paragraph(offset: const Offset(-40.0, 29.0)) diff --git a/packages/flutter/test/widgets/ensure_visible_test.dart b/packages/flutter/test/widgets/ensure_visible_test.dart index ee9e767a60..aae6c7122b 100644 --- a/packages/flutter/test/widgets/ensure_visible_test.dart +++ b/packages/flutter/test/widgets/ensure_visible_test.dart @@ -193,7 +193,7 @@ void main() { height: 200.0, child: new Center( child: new Transform( - transform: new Matrix4.rotationZ(math.PI), + transform: new Matrix4.rotationZ(math.pi), child: new Container( key: const ValueKey(0), width: 100.0, @@ -449,7 +449,7 @@ void main() { height: 200.0, child: new Center( child: new Transform( - transform: new Matrix4.rotationZ(math.PI), + transform: new Matrix4.rotationZ(math.pi), child: new Container( key: const ValueKey(0), width: 100.0, diff --git a/packages/flutter/test/widgets/image_rtl_test.dart b/packages/flutter/test/widgets/image_rtl_test.dart index 7ae8571eb8..bbaf27a289 100644 --- a/packages/flutter/test/widgets/image_rtl_test.dart +++ b/packages/flutter/test/widgets/image_rtl_test.dart @@ -56,7 +56,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -95,7 +95,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -130,7 +130,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -165,7 +165,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -200,7 +200,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -231,7 +231,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -259,7 +259,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -287,7 +287,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -314,7 +314,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -351,7 +351,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -384,7 +384,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -417,7 +417,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -450,7 +450,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -479,7 +479,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -505,7 +505,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -531,7 +531,7 @@ void main() { ), ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); expect(find.byType(Container), paints @@ -551,7 +551,7 @@ void main() { matchTextDirection: false, ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); await tester.pumpWidget( @@ -563,7 +563,7 @@ void main() { matchTextDirection: true, ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); await tester.pumpWidget( @@ -575,7 +575,7 @@ void main() { matchTextDirection: false, ), ), - Duration.ZERO, + Duration.zero, EnginePhase.layout, // so that we don't try to paint the fake images ); }); diff --git a/packages/flutter/test/widgets/key_test.dart b/packages/flutter/test/widgets/key_test.dart index 7355ee50ce..d5d54b28d9 100644 --- a/packages/flutter/test/widgets/key_test.dart +++ b/packages/flutter/test/widgets/key_test.dart @@ -22,7 +22,7 @@ void main() { expect(new ValueKey(nonconst(3)) == new ValueKey(nonconst(3)), isTrue); expect(new ValueKey(nonconst(3)) == new ValueKey(nonconst(3)), isFalse); expect(new ValueKey(nonconst(3)) == new ValueKey(nonconst(2)), isFalse); - expect(const ValueKey(double.NAN) == const ValueKey(double.NAN), isFalse); + expect(const ValueKey(double.nan) == const ValueKey(double.nan), isFalse); expect(new Key(nonconst('')) == new ValueKey(nonconst('')), isTrue); expect(new ValueKey(nonconst('')) == new ValueKey(nonconst('')), isTrue); diff --git a/packages/flutter/test/widgets/linked_scroll_view_test.dart b/packages/flutter/test/widgets/linked_scroll_view_test.dart index 3cd74816b6..457443f41b 100644 --- a/packages/flutter/test/widgets/linked_scroll_view_test.dart +++ b/packages/flutter/test/widgets/linked_scroll_view_test.dart @@ -171,8 +171,8 @@ class LinkedScrollPosition extends ScrollPositionWithSingleContext { assert(beforeOverscroll == 0.0 || afterOverscroll == 0.0); final double localOverscroll = setPixels(value.clamp( - owner.canLinkWithBefore ? minScrollExtent : -double.INFINITY, - owner.canLinkWithAfter ? maxScrollExtent : double.INFINITY, + owner.canLinkWithBefore ? minScrollExtent : -double.infinity, + owner.canLinkWithAfter ? maxScrollExtent : double.infinity, )); assert(localOverscroll == 0.0 || (beforeOverscroll == 0.0 && afterOverscroll == 0.0)); diff --git a/packages/flutter/test/widgets/overscroll_indicator_test.dart b/packages/flutter/test/widgets/overscroll_indicator_test.dart index ae4ad07c4e..e66d20af9c 100644 --- a/packages/flutter/test/widgets/overscroll_indicator_test.dart +++ b/packages/flutter/test/widgets/overscroll_indicator_test.dart @@ -243,11 +243,11 @@ void main() { ); final RenderObject painter = tester.renderObject(find.byType(CustomPaint)); await slowDrag(tester, const Offset(200.0, 200.0), const Offset(5.0, 0.0)); - expect(painter, paints..rotate(angle: math.PI / 2.0)..circle()..saveRestore()); + expect(painter, paints..rotate(angle: math.pi / 2.0)..circle()..saveRestore()); expect(painter, isNot(paints..circle()..circle())); await slowDrag(tester, const Offset(200.0, 200.0), const Offset(-5.0, 0.0)); - expect(painter, paints..rotate(angle: math.PI / 2.0)..circle() - ..rotate(angle: math.PI / 2.0)..circle()); + expect(painter, paints..rotate(angle: math.pi / 2.0)..circle() + ..rotate(angle: math.pi / 2.0)..circle()); await tester.pumpAndSettle(const Duration(seconds: 1)); expect(painter, doesNotOverscroll); @@ -296,7 +296,7 @@ void main() { ); painter = tester.renderObject(find.byType(CustomPaint)); await slowDrag(tester, const Offset(200.0, 200.0), const Offset(5.0, 0.0)); - expect(painter, paints..rotate(angle: math.PI / 2.0)..circle(color: const Color(0x0A00FF00))); + expect(painter, paints..rotate(angle: math.pi / 2.0)..circle(color: const Color(0x0A00FF00))); expect(painter, isNot(paints..circle()..circle())); await tester.pumpAndSettle(const Duration(seconds: 1)); @@ -317,7 +317,7 @@ void main() { ); painter = tester.renderObject(find.byType(CustomPaint)); await slowDrag(tester, const Offset(200.0, 200.0), const Offset(5.0, 0.0)); - expect(painter, paints..rotate(angle: math.PI / 2.0)..circle(color: const Color(0x0A0000FF))..saveRestore()); + expect(painter, paints..rotate(angle: math.pi / 2.0)..circle(color: const Color(0x0A0000FF))..saveRestore()); expect(painter, isNot(paints..circle()..circle())); }); } diff --git a/packages/flutter/test/widgets/sized_box_test.dart b/packages/flutter/test/widgets/sized_box_test.dart index b9a50e227a..53387ab119 100644 --- a/packages/flutter/test/widgets/sized_box_test.dart +++ b/packages/flutter/test/widgets/sized_box_test.dart @@ -28,8 +28,8 @@ void main() { expect(e.height, 2.0); const SizedBox f = const SizedBox.expand(); - expect(f.width, double.INFINITY); - expect(f.height, double.INFINITY); + expect(f.width, double.infinity); + expect(f.height, double.infinity); }); testWidgets('SizedBox - no child', (WidgetTester tester) async { diff --git a/packages/flutter/test/widgets/transform_test.dart b/packages/flutter/test/widgets/transform_test.dart index a9bee7a08d..e7888134f4 100644 --- a/packages/flutter/test/widgets/transform_test.dart +++ b/packages/flutter/test/widgets/transform_test.dart @@ -259,7 +259,7 @@ void main() { testWidgets('Transform.rotate', (WidgetTester tester) async { await tester.pumpWidget( new Transform.rotate( - angle: math.PI / 2.0, + angle: math.pi / 2.0, child: new Opacity(opacity: 0.5, child: new Container()), ), ); diff --git a/packages/flutter/test/widgets/widget_inspector_test.dart b/packages/flutter/test/widgets/widget_inspector_test.dart index 8d1249a832..ee0c11862b 100644 --- a/packages/flutter/test/widgets/widget_inspector_test.dart +++ b/packages/flutter/test/widgets/widget_inspector_test.dart @@ -416,9 +416,9 @@ void main() { service.disposeAllGroups(); final Element elementB = find.text('b').evaluate().first; final String bId = service.toId(elementB, group); - final Object json = JSON.decode(service.getParentChain(bId, group)); - expect(json, isList); - final List chainElements = json; + final Object jsonList = json.decode(service.getParentChain(bId, group)); + expect(jsonList, isList); + final List chainElements = jsonList; final List expectedChain = elementB.debugGetDiagnosticChain()?.reversed?.toList(); // Sanity check that the chain goes back to the root. expect(expectedChain.first, tester.binding.renderViewElement); @@ -458,7 +458,7 @@ void main() { final WidgetInspectorService service = WidgetInspectorService.instance; service.disposeAllGroups(); final String id = service.toId(diagnostic, group); - final List propertiesJson = JSON.decode(service.getProperties(id, group)); + final List propertiesJson = json.decode(service.getProperties(id, group)); final List properties = diagnostic.getProperties(); expect(properties, isNotEmpty); expect(propertiesJson.length, equals(properties.length)); @@ -488,7 +488,7 @@ void main() { final WidgetInspectorService service = WidgetInspectorService.instance; service.disposeAllGroups(); final String id = service.toId(diagnostic, group); - final List propertiesJson = JSON.decode(service.getChildren(id, group)); + final List propertiesJson = json.decode(service.getChildren(id, group)); final List children = diagnostic.getChildren(); expect(children.length, equals(3)); expect(propertiesJson.length, equals(children.length)); @@ -520,7 +520,7 @@ void main() { service.disposeAllGroups(); service.setPubRootDirectories([]); service.setSelection(elementA, 'my-group'); - final Map jsonA = JSON.decode(service.getSelectedWidget(null, 'my-group')); + final Map jsonA = json.decode(service.getSelectedWidget(null, 'my-group')); final Map creationLocationA = jsonA['creationLocation']; expect(creationLocationA, isNotNull); final String fileA = creationLocationA['file']; @@ -529,7 +529,7 @@ void main() { final List parameterLocationsA = creationLocationA['parameterLocations']; service.setSelection(elementB, 'my-group'); - final Map jsonB = JSON.decode(service.getSelectedWidget(null, 'my-group')); + final Map jsonB = json.decode(service.getSelectedWidget(null, 'my-group')); final Map creationLocationB = jsonB['creationLocation']; expect(creationLocationB, isNotNull); final String fileB = creationLocationB['file']; @@ -581,12 +581,12 @@ void main() { service.disposeAllGroups(); service.setPubRootDirectories([]); service.setSelection(elementA, 'my-group'); - Map json = JSON.decode(service.getSelectedWidget(null, 'my-group')); - Map creationLocation = json['creationLocation']; + Map jsonObject = json.decode(service.getSelectedWidget(null, 'my-group')); + Map creationLocation = jsonObject['creationLocation']; expect(creationLocation, isNotNull); final String fileA = creationLocation['file']; expect(fileA, endsWith('widget_inspector_test.dart')); - expect(json, isNot(contains('createdByLocalProject'))); + expect(jsonObject, isNot(contains('createdByLocalProject'))); final List segments = Uri.parse(fileA).pathSegments; // Strip a couple subdirectories away to generate a plausible pub root // directory. @@ -594,22 +594,22 @@ void main() { service.setPubRootDirectories([pubRootTest]); service.setSelection(elementA, 'my-group'); - expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); + expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); service.setPubRootDirectories(['/invalid/$pubRootTest']); - expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject'))); + expect(json.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject'))); service.setPubRootDirectories(['file://$pubRootTest']); - expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); + expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); service.setPubRootDirectories(['$pubRootTest/different']); - expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject'))); + expect(json.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject'))); service.setPubRootDirectories([ '/invalid/$pubRootTest', pubRootTest, ]); - expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); + expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); // The RichText child of the Text widget is created by the core framework // not the current package. @@ -619,9 +619,9 @@ void main() { ).evaluate().first; service.setSelection(richText, 'my-group'); service.setPubRootDirectories([pubRootTest]); - json = JSON.decode(service.getSelectedWidget(null, 'my-group')); - expect(json, isNot(contains('createdByLocalProject'))); - creationLocation = json['creationLocation']; + jsonObject = json.decode(service.getSelectedWidget(null, 'my-group')); + expect(jsonObject, isNot(contains('createdByLocalProject'))); + creationLocation = jsonObject['creationLocation']; expect(creationLocation, isNotNull); // This RichText widget is created by the build method of the Text widget // thus the creation location is in text.dart not basic.dart @@ -631,14 +631,14 @@ void main() { // Strip off /src/widgets/text.dart. final String pubRootFramework = '/' + pathSegmentsFramework.take(pathSegmentsFramework.length - 3).join('/'); service.setPubRootDirectories([pubRootFramework]); - expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); + expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); service.setSelection(elementA, 'my-group'); - expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject'))); + expect(json.decode(service.getSelectedWidget(null, 'my-group')), isNot(contains('createdByLocalProject'))); service.setPubRootDirectories([pubRootFramework, pubRootTest]); service.setSelection(elementA, 'my-group'); - expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); + expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); service.setSelection(richText, 'my-group'); - expect(JSON.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); + expect(json.decode(service.getSelectedWidget(null, 'my-group')), contains('createdByLocalProject')); }, skip: !WidgetInspectorService.instance.isWidgetCreationTracked()); // Test requires --track-widget-creation flag. } diff --git a/packages/flutter_driver/lib/src/driver/driver.dart b/packages/flutter_driver/lib/src/driver/driver.dart index f221752d4c..c269187652 100644 --- a/packages/flutter_driver/lib/src/driver/driver.dart +++ b/packages/flutter_driver/lib/src/driver/driver.dart @@ -530,7 +530,7 @@ class FlutterDriver { await new Future.delayed(const Duration(seconds: 2)); final Map result = await _peer.sendRequest('_flutter.screenshot').timeout(timeout); - return BASE64.decode(result['screenshot']); + return base64.decode(result['screenshot']); } /// Returns the Flags set in the Dart VM as JSON. diff --git a/packages/flutter_driver/lib/src/driver/timeline_summary.dart b/packages/flutter_driver/lib/src/driver/timeline_summary.dart index 61d25cdd0e..7e90be1340 100644 --- a/packages/flutter_driver/lib/src/driver/timeline_summary.dart +++ b/packages/flutter_driver/lib/src/driver/timeline_summary.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert' show JSON, JsonEncoder; +import 'dart:convert' show json, JsonEncoder; import 'dart:math' as math; import 'package:file/file.dart'; @@ -112,10 +112,10 @@ class TimelineSummary { await file.writeAsString(_encodeJson(summaryJson, pretty)); } - String _encodeJson(Map json, bool pretty) { + String _encodeJson(Map jsonObject, bool pretty) { return pretty - ? _prettyEncoder.convert(json) - : JSON.encode(json); + ? _prettyEncoder.convert(jsonObject) + : json.encode(jsonObject); } List _extractNamedEvents(String name) { diff --git a/packages/flutter_driver/lib/src/extension/extension.dart b/packages/flutter_driver/lib/src/extension/extension.dart index 18c7631c70..2c892401d6 100644 --- a/packages/flutter_driver/lib/src/extension/extension.dart +++ b/packages/flutter_driver/lib/src/extension/extension.dart @@ -298,7 +298,7 @@ class FlutterDriverExtension { Future _scroll(Command command) async { final Scroll scrollCommand = command; final Finder target = await _waitForElement(_createFinder(scrollCommand.finder)); - final int totalMoves = scrollCommand.duration.inMicroseconds * scrollCommand.frequency ~/ Duration.MICROSECONDS_PER_SECOND; + final int totalMoves = scrollCommand.duration.inMicroseconds * scrollCommand.frequency ~/ Duration.microsecondsPerSecond; final Offset delta = new Offset(scrollCommand.dx, scrollCommand.dy) / totalMoves.toDouble(); final Duration pause = scrollCommand.duration ~/ totalMoves; final Offset startLocation = _prober.getCenter(target); diff --git a/packages/flutter_driver/test/src/timeline_summary_test.dart b/packages/flutter_driver/test/src/timeline_summary_test.dart index cfa906607b..dc9dd8ea22 100644 --- a/packages/flutter_driver/test/src/timeline_summary_test.dart +++ b/packages/flutter_driver/test/src/timeline_summary_test.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:convert' show JSON; +import 'dart:convert' show json; import 'package:file/file.dart'; import 'package:flutter_driver/flutter_driver.dart'; @@ -245,7 +245,7 @@ void main() { ]).writeSummaryToFile('test', destinationDirectory: tempDir.path); final String written = await fs.file(path.join(tempDir.path, 'test.timeline_summary.json')).readAsString(); - expect(JSON.decode(written), { + expect(json.decode(written), { 'average_frame_build_time_millis': 7.0, 'worst_frame_build_time_millis': 11.0, 'missed_frame_build_budget_count': 2, diff --git a/packages/flutter_localizations/test/date_picker_test.dart b/packages/flutter_localizations/test/date_picker_test.dart index 81ab1f0ecb..b0442eb41e 100644 --- a/packages/flutter_localizations/test/date_picker_test.dart +++ b/packages/flutter_localizations/test/date_picker_test.dart @@ -14,9 +14,9 @@ void main() { DateTime initialDate; setUp(() { - firstDate = new DateTime(2001, DateTime.JANUARY, 1); - lastDate = new DateTime(2031, DateTime.DECEMBER, 31); - initialDate = new DateTime(2016, DateTime.JANUARY, 15); + firstDate = new DateTime(2001, DateTime.january, 1); + lastDate = new DateTime(2031, DateTime.december, 31); + initialDate = new DateTime(2016, DateTime.january, 15); }); group(DayPicker, () { diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart index f2779f31c3..87f28db3e2 100644 --- a/packages/flutter_tools/lib/src/android/android_device.dart +++ b/packages/flutter_tools/lib/src/android/android_device.dart @@ -80,12 +80,12 @@ class AndroidDevice extends Device { printTrace(propCommand.join(' ')); try { - // We pass an encoding of LATIN1 so that we don't try and interpret the + // We pass an encoding of latin1 so that we don't try and interpret the // `adb shell getprop` result as UTF8. final ProcessResult result = await processManager.run( propCommand, - stdoutEncoding: LATIN1, - stderrEncoding: LATIN1, + stdoutEncoding: latin1, + stderrEncoding: latin1, ).timeout(const Duration(seconds: 5)); if (result.exitCode == 0) { _properties = parseAdbDeviceProperties(result.stdout); @@ -522,7 +522,7 @@ class AndroidDevice extends Device { final StreamSubscription logs = getLogReader().logLines.listen((String line) { final Match match = discoverExp.firstMatch(line); if (match != null) { - final Map app = JSON.decode(match.group(1)); + final Map app = json.decode(match.group(1)); result.add(new DiscoveredApp(app['id'], app['observatoryPort'])); } }); diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart index 454a49f74c..0915d174e4 100644 --- a/packages/flutter_tools/lib/src/asset.dart +++ b/packages/flutter_tools/lib/src/asset.dart @@ -206,7 +206,7 @@ class _ManifestAssetBundle implements AssetBundle { if (fonts.isNotEmpty) - entries[_kFontManifestJson] = new DevFSStringContent(JSON.encode(fonts)); + entries[_kFontManifestJson] = new DevFSStringContent(json.encode(fonts)); // TODO(ianh): Only do the following line if we've changed packages or if our LICENSE file changed entries[_kLICENSE] = await _obtainLicenses(packageMap, assetBasePath, reportPackages: reportLicensedPackages); @@ -368,14 +368,14 @@ Future _obtainLicenses( } DevFSContent _createAssetManifest(Map<_Asset, List<_Asset>> assetVariants) { - final Map> json = >{}; + final Map> jsonObject = >{}; for (_Asset main in assetVariants.keys) { final List variants = []; for (_Asset variant in assetVariants[main]) variants.add(variant.entryUri.path); - json[main.entryUri.path] = variants; + jsonObject[main.entryUri.path] = variants; } - return new DevFSStringContent(JSON.encode(json)); + return new DevFSStringContent(json.encode(jsonObject)); } List> _parseFonts( diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart index 0f92167642..2f707746e2 100644 --- a/packages/flutter_tools/lib/src/base/build.dart +++ b/packages/flutter_tools/lib/src/base/build.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert' show JSON; +import 'dart:convert' show json; import 'package:crypto/crypto.dart' show md5; import 'package:meta/meta.dart'; @@ -79,8 +79,8 @@ class Fingerprint { /// /// Throws [ArgumentError], if there is a version mismatch between the /// serializing framework and this framework. - Fingerprint.fromJson(String json) { - final Map content = JSON.decode(json); + Fingerprint.fromJson(String jsonData) { + final Map content = json.decode(jsonData); final String version = content['version']; if (version != FlutterVersion.instance.frameworkRevision) @@ -92,7 +92,7 @@ class Fingerprint { Map _checksums; Map _properties; - String toJson() => JSON.encode({ + String toJson() => json.encode({ 'version': FlutterVersion.instance.frameworkRevision, 'properties': _properties, 'files': _checksums, diff --git a/packages/flutter_tools/lib/src/base/config.dart b/packages/flutter_tools/lib/src/base/config.dart index 373173f3c5..770332658a 100644 --- a/packages/flutter_tools/lib/src/base/config.dart +++ b/packages/flutter_tools/lib/src/base/config.dart @@ -12,7 +12,7 @@ class Config { Config([File configFile]) { _configFile = configFile ?? fs.file(fs.path.join(_userHomeDir(), '.flutter_settings')); if (_configFile.existsSync()) - _values = JSON.decode(_configFile.readAsStringSync()); + _values = json.decode(_configFile.readAsStringSync()); } static Config get instance => context[Config]; diff --git a/packages/flutter_tools/lib/src/base/process.dart b/packages/flutter_tools/lib/src/base/process.dart index 2c573e0bc5..31b7071404 100644 --- a/packages/flutter_tools/lib/src/base/process.dart +++ b/packages/flutter_tools/lib/src/base/process.dart @@ -137,7 +137,7 @@ Future runCommandAndStreamOutput(List cmd, { environment: environment ); final StreamSubscription stdoutSubscription = process.stdout - .transform(UTF8.decoder) + .transform(utf8.decoder) .transform(const LineSplitter()) .where((String line) => filter == null ? true : filter.hasMatch(line)) .listen((String line) { @@ -152,7 +152,7 @@ Future runCommandAndStreamOutput(List cmd, { } }); final StreamSubscription stderrSubscription = process.stderr - .transform(UTF8.decoder) + .transform(utf8.decoder) .transform(const LineSplitter()) .where((String line) => filter == null ? true : filter.hasMatch(line)) .listen((String line) { diff --git a/packages/flutter_tools/lib/src/base/terminal.dart b/packages/flutter_tools/lib/src/base/terminal.dart index f777c90da4..799043673f 100644 --- a/packages/flutter_tools/lib/src/base/terminal.dart +++ b/packages/flutter_tools/lib/src/base/terminal.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert' show ASCII; +import 'dart:convert' show ascii; import 'package:quiver/strings.dart'; @@ -87,7 +87,7 @@ class AnsiTerminal { /// /// Useful when the console is in [singleCharMode]. Stream get onCharInput { - _broadcastStdInString ??= io.stdin.transform(ASCII.decoder).asBroadcastStream(); + _broadcastStdInString ??= io.stdin.transform(ascii.decoder).asBroadcastStream(); return _broadcastStdInString; } diff --git a/packages/flutter_tools/lib/src/base/utils.dart b/packages/flutter_tools/lib/src/base/utils.dart index cbbc5ddb99..f980e19481 100644 --- a/packages/flutter_tools/lib/src/base/utils.dart +++ b/packages/flutter_tools/lib/src/base/utils.dart @@ -114,7 +114,7 @@ final NumberFormat kSecondsFormat = new NumberFormat('0.0'); final NumberFormat kMillisecondsFormat = new NumberFormat.decimalPattern(); String getElapsedAsSeconds(Duration duration) { - final double seconds = duration.inMilliseconds / Duration.MILLISECONDS_PER_SECOND; + final double seconds = duration.inMilliseconds / Duration.millisecondsPerSecond; return '${kSecondsFormat.format(seconds)}s'; } @@ -239,7 +239,7 @@ typedef Future AsyncCallback(); /// - has a different initial value for the first callback delay /// - waits for a callback to be complete before it starts the next timer class Poller { - Poller(this.callback, this.pollingInterval, { this.initialDelay: Duration.ZERO }) { + Poller(this.callback, this.pollingInterval, { this.initialDelay: Duration.zero }) { new Future.delayed(initialDelay, _handleCallback); } diff --git a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart index 1982cebd98..55e581881b 100644 --- a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart +++ b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart @@ -181,10 +181,10 @@ class AnalysisServer { // This callback hookup can't throw. _process.exitCode.whenComplete(() => _process = null); // ignore: unawaited_futures - final Stream errorStream = _process.stderr.transform(UTF8.decoder).transform(const LineSplitter()); + final Stream errorStream = _process.stderr.transform(utf8.decoder).transform(const LineSplitter()); errorStream.listen(printError); - final Stream inStream = _process.stdout.transform(UTF8.decoder).transform(const LineSplitter()); + final Stream inStream = _process.stdout.transform(utf8.decoder).transform(const LineSplitter()); inStream.listen(_handleServerResponse); // Available options (many of these are obsolete): @@ -212,7 +212,7 @@ class AnalysisServer { Future get onExit => _process.exitCode; void _sendCommand(String method, Map params) { - final String message = JSON.encode( { + final String message = json.encode( { 'id': (++_id).toString(), 'method': method, 'params': params @@ -224,7 +224,7 @@ class AnalysisServer { void _handleServerResponse(String line) { printTrace('<== $line'); - final dynamic response = JSON.decode(line); + final dynamic response = json.decode(line); if (response is Map) { if (response['event'] != null) { diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index 46c1373a4f..cad13b3db1 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart @@ -693,12 +693,12 @@ class DeviceDomain extends Domain { } Stream> get stdinCommandStream => stdin - .transform(UTF8.decoder) + .transform(utf8.decoder) .transform(const LineSplitter()) .where((String line) => line.startsWith('[{') && line.endsWith('}]')) .map((String line) { line = line.substring(1, line.length - 1); - return JSON.decode(line); + return json.decode(line); }); void stdoutCommandResponse(Map command) { @@ -706,7 +706,7 @@ void stdoutCommandResponse(Map command) { } String jsonEncodeObject(dynamic object) { - return JSON.encode(object, toEncodable: _toEncodable); + return json.encode(object, toEncodable: _toEncodable); } dynamic _toEncodable(dynamic object) { diff --git a/packages/flutter_tools/lib/src/commands/screenshot.dart b/packages/flutter_tools/lib/src/commands/screenshot.dart index 51554fb999..7ee2dd4325 100644 --- a/packages/flutter_tools/lib/src/commands/screenshot.dart +++ b/packages/flutter_tools/lib/src/commands/screenshot.dart @@ -85,7 +85,7 @@ class ScreenshotCommand extends FlutterCommand { outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'skp'); final IOSink sink = outputFile.openWrite(); - sink.add(BASE64.decode(skp['skp'])); + sink.add(base64.decode(skp['skp'])); await sink.close(); await showOutputFileInfo(outputFile); if (await outputFile.length() < 1000) { diff --git a/packages/flutter_tools/lib/src/commands/trace.dart b/packages/flutter_tools/lib/src/commands/trace.dart index 045200d2a5..eb670251a3 100644 --- a/packages/flutter_tools/lib/src/commands/trace.dart +++ b/packages/flutter_tools/lib/src/commands/trace.dart @@ -82,7 +82,7 @@ class TraceCommand extends FlutterCommand { localFile = getUniqueFile(fs.currentDirectory, 'trace', 'json'); } - await localFile.writeAsString(JSON.encode(timeline)); + await localFile.writeAsString(json.encode(timeline)); printStatus('Trace file saved to ${localFile.path}'); } diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index 24e6f91691..70a330484a 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -107,10 +107,10 @@ Future compile( final _StdoutHandler stdoutHandler = new _StdoutHandler(); server.stderr - .transform(UTF8.decoder) + .transform(utf8.decoder) .listen((String s) { printError('compiler message: $s'); }); server.stdout - .transform(UTF8.decoder) + .transform(utf8.decoder) .transform(const LineSplitter()) .listen(stdoutHandler.handler); final int exitCode = await server.exitCode; @@ -190,7 +190,7 @@ class ResidentCompiler { } _server = await processManager.start(args); _server.stdout - .transform(UTF8.decoder) + .transform(utf8.decoder) .transform(const LineSplitter()) .listen( stdoutHandler.handler, @@ -203,7 +203,7 @@ class ResidentCompiler { }); _server.stderr - .transform(UTF8.decoder) + .transform(utf8.decoder) .transform(const LineSplitter()) .listen((String s) { printError('compiler message: $s'); }); diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index 01ef56599b..4af38acc05 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert' show BASE64, UTF8; +import 'dart:convert' show base64, utf8; import 'package:json_rpc_2/json_rpc_2.dart' as rpc; @@ -172,7 +172,7 @@ class DevFSByteContent extends DevFSContent { /// String content to be copied to the device. class DevFSStringContent extends DevFSByteContent { - DevFSStringContent(String string) : _string = string, super(UTF8.encode(string)); + DevFSStringContent(String string) : _string = string, super(utf8.encode(string)); String _string; @@ -180,12 +180,12 @@ class DevFSStringContent extends DevFSByteContent { set string(String value) { _string = value; - super.bytes = UTF8.encode(_string); + super.bytes = utf8.encode(_string); } @override set bytes(List value) { - string = UTF8.decode(value); + string = utf8.decode(value); } } @@ -223,7 +223,7 @@ class ServiceProtocolDevFSOperations implements DevFSOperations { } catch (e) { return e; } - final String fileContents = BASE64.encode(bytes); + final String fileContents = base64.encode(bytes); try { return await vmService.vm.invokeRpcRaw( '_writeDevFSFile', @@ -299,7 +299,7 @@ class _DevFSHttpWriter { request.headers.removeAll(HttpHeaders.ACCEPT_ENCODING); request.headers.add('dev_fs_name', fsName); request.headers.add('dev_fs_uri_b64', - BASE64.encode(UTF8.encode(deviceUri.toString()))); + base64.encode(utf8.encode(deviceUri.toString()))); final Stream> contents = content.contentsAsCompressedStream(); await request.addStream(contents); final HttpClientResponse response = await request.close(); diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart index dde9437e17..2e1ca550dd 100644 --- a/packages/flutter_tools/lib/src/doctor.dart +++ b/packages/flutter_tools/lib/src/doctor.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert' show UTF8; +import 'dart:convert' show utf8; import 'package:archive/archive.dart'; @@ -409,7 +409,7 @@ abstract class IntelliJValidator extends DoctorValidator { try { final Archive archive = new ZipDecoder().decodeBytes(fs.file(jarPath).readAsBytesSync()); final ArchiveFile file = archive.findFile('META-INF/plugin.xml'); - final String content = UTF8.decode(file.content); + final String content = utf8.decode(file.content); const String versionStartTag = ''; final int start = content.indexOf(versionStartTag); final int end = content.indexOf('', start); diff --git a/packages/flutter_tools/lib/src/ios/code_signing.dart b/packages/flutter_tools/lib/src/ios/code_signing.dart index b891e29f52..54f2289697 100644 --- a/packages/flutter_tools/lib/src/ios/code_signing.dart +++ b/packages/flutter_tools/lib/src/ios/code_signing.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'dart:async'; -import 'dart:convert' show UTF8; +import 'dart:convert' show utf8; import 'package:quiver/strings.dart'; @@ -146,7 +146,7 @@ Future getCodeSigningIdentityDevelopmentTeam({BuildableIOSApp iosApp, bo ..write(signingCertificate) ..close(); - final String opensslOutput = await UTF8.decodeStream(opensslProcess.stdout); + final String opensslOutput = await utf8.decodeStream(opensslProcess.stdout); // Fire and forget discard of the stderr stream so we don't hold onto resources. // Don't care about the result. opensslProcess.stderr.drain(); // ignore: unawaited_futures diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart index 9fd3505c4b..d663bcde70 100644 --- a/packages/flutter_tools/lib/src/ios/devices.dart +++ b/packages/flutter_tools/lib/src/ios/devices.dart @@ -383,7 +383,7 @@ String decodeSyslog(String line) { int decodeOctal(int x, int y, int z) => (x & 0x3) << 6 | (y & 0x7) << 3 | z & 0x7; try { - final List bytes = UTF8.encode(line); + final List bytes = utf8.encode(line); final List out = []; for (int i = 0; i < bytes.length; ) { if (bytes[i] != kBackslash || i > bytes.length - 4) { @@ -407,7 +407,7 @@ String decodeSyslog(String line) { i += 4; } } - return UTF8.decode(out); + return utf8.decode(out); } catch (_) { // Unable to decode line: return as-is. return line; @@ -445,8 +445,8 @@ class _IOSDeviceLogReader extends DeviceLogReader { void _start() { iMobileDevice.startLogger().then((Process process) { _process = process; - _process.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine); - _process.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine); + _process.stdout.transform(utf8.decoder).transform(const LineSplitter()).listen(_onLine); + _process.stderr.transform(utf8.decoder).transform(const LineSplitter()).listen(_onLine); _process.exitCode.whenComplete(() { if (_linesController.hasListener) _linesController.close(); diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart index 49eb677420..e713871de0 100644 --- a/packages/flutter_tools/lib/src/ios/mac.dart +++ b/packages/flutter_tools/lib/src/ios/mac.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert' show JSON; +import 'dart:convert' show json; import 'package:meta/meta.dart'; @@ -566,8 +566,8 @@ void _copyServiceDefinitionsManifest(List> services, File ma // the directory and basenames. 'framework': fs.path.basenameWithoutExtension(service['ios-framework']) }).toList(); - final Map json = { 'services' : jsonServices }; - manifest.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true); + final Map jsonObject = { 'services' : jsonServices }; + manifest.writeAsStringSync(json.encode(jsonObject), mode: FileMode.WRITE, flush: true); } Future upgradePbxProjWithFlutterAssets(String app) async { diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart index c2222dfaa1..6b60309fd8 100644 --- a/packages/flutter_tools/lib/src/ios/simulators.dart +++ b/packages/flutter_tools/lib/src/ios/simulators.dart @@ -87,7 +87,7 @@ class SimControl { return >{}; } - return JSON.decode(results.stdout)[section.name]; + return json.decode(results.stdout)[section.name]; } /// Returns a list of all available devices, both potential and connected. @@ -540,15 +540,15 @@ class _IOSSimulatorLogReader extends DeviceLogReader { // Device log. await device.ensureLogsExists(); _deviceProcess = await launchDeviceLogTool(device); - _deviceProcess.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onDeviceLine); - _deviceProcess.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onDeviceLine); + _deviceProcess.stdout.transform(utf8.decoder).transform(const LineSplitter()).listen(_onDeviceLine); + _deviceProcess.stderr.transform(utf8.decoder).transform(const LineSplitter()).listen(_onDeviceLine); // Track system.log crashes. // ReportCrash[37965]: Saved crash report for FlutterRunner[37941]... _systemProcess = await launchSystemLogTool(device); if (_systemProcess != null) { - _systemProcess.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onSystemLine); - _systemProcess.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onSystemLine); + _systemProcess.stdout.transform(utf8.decoder).transform(const LineSplitter()).listen(_onSystemLine); + _systemProcess.stderr.transform(utf8.decoder).transform(const LineSplitter()).listen(_onSystemLine); } // We don't want to wait for the process or its callback. Best effort diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart index 6572c36d67..2d2a1697f2 100644 --- a/packages/flutter_tools/lib/src/project.dart +++ b/packages/flutter_tools/lib/src/project.dart @@ -106,7 +106,7 @@ Future _firstMatchInFile(File file, RegExp regExp) async { } return file .openRead() - .transform(UTF8.decoder) + .transform(utf8.decoder) .transform(const LineSplitter()) .map(regExp.firstMatch) .firstWhere((Match match) => match != null, orElse: () => null); diff --git a/packages/flutter_tools/lib/src/services.dart b/packages/flutter_tools/lib/src/services.dart index 863b098e14..fbd142ed62 100644 --- a/packages/flutter_tools/lib/src/services.dart +++ b/packages/flutter_tools/lib/src/services.dart @@ -103,8 +103,8 @@ File generateServiceDefinitions( 'class': service['android-class'] }).toList(); - final Map json = { 'services': services }; + final Map jsonObject = { 'services': services }; final File servicesFile = fs.file(fs.path.join(dir, 'services.json')); - servicesFile.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true); + servicesFile.writeAsStringSync(json.encode(jsonObject), mode: FileMode.WRITE, flush: true); return servicesFile; } diff --git a/packages/flutter_tools/lib/src/test/event_printer.dart b/packages/flutter_tools/lib/src/test/event_printer.dart index a9e2c89529..af3c34a448 100644 --- a/packages/flutter_tools/lib/src/test/event_printer.dart +++ b/packages/flutter_tools/lib/src/test/event_printer.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:convert' show JSON; +import 'dart:convert' show json; import '../base/io.dart' show stdout; import 'watcher.dart'; @@ -28,7 +28,7 @@ class EventPrinter extends TestWatcher { } void _send(Map command) { - final String encoded = JSON.encode(command, toEncodable: _jsonEncodeObject); + final String encoded = json.encode(command, toEncodable: _jsonEncodeObject); _out.writeln('\n[$encoded]'); } diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart index 80de48428a..b6ebe17f03 100644 --- a/packages/flutter_tools/lib/src/test/flutter_platform.dart +++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart @@ -383,7 +383,7 @@ class _FlutterPlatform extends PlatformPlugin { final Completer harnessDone = new Completer(); final StreamSubscription harnessToTest = controller.stream.listen( - (dynamic event) { testSocket.add(JSON.encode(event)); }, + (dynamic event) { testSocket.add(json.encode(event)); }, onDone: harnessDone.complete, onError: (dynamic error, dynamic stack) { // If you reach here, it's unlikely we're going to be able to really handle this well. @@ -402,7 +402,7 @@ class _FlutterPlatform extends PlatformPlugin { final StreamSubscription testToHarness = testSocket.listen( (dynamic encodedEvent) { assert(encodedEvent is String); // we shouldn't ever get binary messages - controller.sink.add(JSON.decode(encodedEvent)); + controller.sink.add(json.decode(encodedEvent)); }, onDone: testDone.complete, onError: (dynamic error, dynamic stack) { @@ -584,9 +584,9 @@ void main() { WebSocket.connect(server).then((WebSocket socket) { socket.map((dynamic x) { assert(x is String); - return JSON.decode(x); + return json.decode(x); }).pipe(channel.sink); - socket.addStream(channel.stream.map(JSON.encode)); + socket.addStream(channel.stream.map(json.encode)); }); } '''; @@ -673,7 +673,7 @@ void main() { for (Stream> stream in >>[process.stderr, process.stdout]) { - stream.transform(UTF8.decoder) + stream.transform(utf8.decoder) .transform(const LineSplitter()) .listen( (String line) { diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart index f9c29c94e9..30b74c0351 100644 --- a/packages/flutter_tools/lib/src/version.dart +++ b/packages/flutter_tools/lib/src/version.dart @@ -336,11 +336,11 @@ class VersionCheckStamp { if (versionCheckStamp != null) { // Attempt to parse stamp JSON. try { - final dynamic json = JSON.decode(versionCheckStamp); - if (json is Map) { - return fromJson(json); + final dynamic jsonObject = json.decode(versionCheckStamp); + if (jsonObject is Map) { + return fromJson(jsonObject); } else { - printTrace('Warning: expected version stamp to be a Map but found: $json'); + printTrace('Warning: expected version stamp to be a Map but found: $jsonObject'); } } catch (error, stackTrace) { // Do not crash if JSON is malformed. @@ -352,10 +352,10 @@ class VersionCheckStamp { return const VersionCheckStamp(); } - static VersionCheckStamp fromJson(Map json) { + static VersionCheckStamp fromJson(Map jsonObject) { DateTime readDateTime(String property) { - return json.containsKey(property) - ? DateTime.parse(json[property]) + return jsonObject.containsKey(property) + ? DateTime.parse(jsonObject[property]) : null; } diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart index a97ef68088..d2dd708415 100644 --- a/packages/flutter_tools/lib/src/vmservice.dart +++ b/packages/flutter_tools/lib/src/vmservice.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert' show BASE64; +import 'dart:convert' show base64; import 'dart:math' as math; import 'package:file/file.dart'; @@ -799,7 +799,7 @@ class VM extends ServiceObjectOwner { params: { 'fsName': fsName, 'path': path, - 'fileContents': BASE64.encode(fileContents), + 'fileContents': base64.encode(fileContents), }, ); } @@ -813,7 +813,7 @@ class VM extends ServiceObjectOwner { 'path': path, }, ); - return BASE64.decode(response['fileContents']); + return base64.decode(response['fileContents']); } /// The complete list of a file system. @@ -896,14 +896,14 @@ class HeapSpace extends ServiceObject { Duration get avgCollectionTime { final double mcs = _totalCollectionTimeInSeconds * - Duration.MICROSECONDS_PER_SECOND / + Duration.microsecondsPerSecond / math.max(_collections, 1); return new Duration(microseconds: mcs.ceil()); } Duration get avgCollectionPeriod { final double mcs = _averageCollectionPeriodInMillis * - Duration.MICROSECONDS_PER_MILLISECOND; + Duration.microsecondsPerMillisecond; return new Duration(microseconds: mcs.ceil()); } diff --git a/packages/flutter_tools/lib/src/vmservice_record_replay.dart b/packages/flutter_tools/lib/src/vmservice_record_replay.dart index bfde734d2d..cce144204d 100644 --- a/packages/flutter_tools/lib/src/vmservice_record_replay.dart +++ b/packages/flutter_tools/lib/src/vmservice_record_replay.dart @@ -94,13 +94,13 @@ abstract class _Message implements Comparable<_Message> { /// A VM service JSON-rpc request (sent to the VM). class _Request extends _Message { _Request(Map data) : super(_kRequest, data); - _Request.fromString(String data) : this(JSON.decoder.convert(data)); + _Request.fromString(String data) : this(json.decoder.convert(data)); } /// A VM service JSON-rpc response (from the VM). class _Response extends _Message { _Response(Map data) : super(_kResponse, data); - _Response.fromString(String data) : this(JSON.decoder.convert(data)); + _Response.fromString(String data) : this(json.decoder.convert(data)); } /// A matching request/response pair. @@ -203,8 +203,8 @@ class ReplayVMServiceChannel extends StreamChannelMixin { static Map _loadTransactions(Directory location) { final File file = _getManifest(location); - final String json = file.readAsStringSync(); - final Iterable<_Message> messages = JSON.decoder.convert(json).map<_Message>(_toMessage); + final String jsonData = file.readAsStringSync(); + final Iterable<_Message> messages = json.decoder.convert(jsonData).map<_Message>(_toMessage); final Map transactions = {}; for (_Message message in messages) { final _Transaction transaction = @@ -236,7 +236,7 @@ class ReplayVMServiceChannel extends StreamChannelMixin { printStatus('Exiting due to dangling request'); exit(0); } else { - _controller.add(JSON.encoder.convert(transaction.response.data)); + _controller.add(json.encoder.convert(transaction.response.data)); if (_transactions.isEmpty) _controller.close(); } diff --git a/packages/flutter_tools/lib/src/vscode/vscode.dart b/packages/flutter_tools/lib/src/vscode/vscode.dart index 9671696e2e..7eace4cb2b 100644 --- a/packages/flutter_tools/lib/src/vscode/vscode.dart +++ b/packages/flutter_tools/lib/src/vscode/vscode.dart @@ -181,8 +181,8 @@ class VsCode { if (!fs.isFileSync(packageJsonPath)) return null; final String jsonString = fs.file(packageJsonPath).readAsStringSync(); - final Map json = JSON.decode(jsonString); - return json['version']; + final Map jsonObject = json.decode(jsonString); + return jsonObject['version']; } } diff --git a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart index 8c720b5314..db8270f754 100644 --- a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart +++ b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart @@ -65,7 +65,7 @@ $fontsSection final String entryKey = 'packages/$packageName/$packageFont'; expect(bundle.entries.containsKey(entryKey), true); expect( - UTF8.decode(await bundle.entries[entryKey].contentsAsBytes()), + utf8.decode(await bundle.entries[entryKey].contentsAsBytes()), packageFont, ); } @@ -73,14 +73,14 @@ $fontsSection for (String localFont in localFonts) { expect(bundle.entries.containsKey(localFont), true); expect( - UTF8.decode(await bundle.entries[localFont].contentsAsBytes()), + utf8.decode(await bundle.entries[localFont].contentsAsBytes()), localFont, ); } } expect( - UTF8.decode(await bundle.entries['FontManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['FontManifest.json'].contentsAsBytes()), expectedAssetManifest, ); } diff --git a/packages/flutter_tools/test/asset_bundle_package_test.dart b/packages/flutter_tools/test/asset_bundle_package_test.dart index af1183cb95..630a32bdc5 100644 --- a/packages/flutter_tools/test/asset_bundle_package_test.dart +++ b/packages/flutter_tools/test/asset_bundle_package_test.dart @@ -72,14 +72,14 @@ $assetsSection final String entryKey = 'packages/$packageName/$asset'; expect(bundle.entries.containsKey(entryKey), true); expect( - UTF8.decode(await bundle.entries[entryKey].contentsAsBytes()), + utf8.decode(await bundle.entries[entryKey].contentsAsBytes()), asset, ); } } expect( - UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), expectedAssetManifest, ); } @@ -127,7 +127,7 @@ $assetsSection expect(bundle.entries.length, 2); // LICENSE, AssetManifest const String expectedAssetManifest = '{}'; expect( - UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), expectedAssetManifest, ); }); @@ -147,7 +147,7 @@ $assetsSection expect(bundle.entries.length, 2); // LICENSE, AssetManifest const String expectedAssetManifest = '{}'; expect( - UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), expectedAssetManifest, ); diff --git a/packages/flutter_tools/test/asset_bundle_test.dart b/packages/flutter_tools/test/asset_bundle_test.dart index 1f9f053fda..c8f663c6d2 100644 --- a/packages/flutter_tools/test/asset_bundle_test.dart +++ b/packages/flutter_tools/test/asset_bundle_test.dart @@ -59,7 +59,7 @@ void main() { expect(bundle.entries.length, 1); const String expectedAssetManifest = '{}'; expect( - UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), expectedAssetManifest, ); }); diff --git a/packages/flutter_tools/test/asset_bundle_variant_test.dart b/packages/flutter_tools/test/asset_bundle_variant_test.dart index 207e4455e6..d3c37f447b 100644 --- a/packages/flutter_tools/test/asset_bundle_variant_test.dart +++ b/packages/flutter_tools/test/asset_bundle_variant_test.dart @@ -77,7 +77,7 @@ flutter: // The main asset file, /a/b/c/foo, and its variants exist. for (String asset in assets) { expect(bundle.entries.containsKey(asset), true); - expect(UTF8.decode(await bundle.entries[asset].contentsAsBytes()), asset); + expect(utf8.decode(await bundle.entries[asset].contentsAsBytes()), asset); } fs.file('a/b/c/foo').deleteSync(); @@ -89,7 +89,7 @@ flutter: expect(bundle.entries.containsKey('a/b/c/foo'), false); for (String asset in assets.skip(1)) { expect(bundle.entries.containsKey(asset), true); - expect(UTF8.decode(await bundle.entries[asset].contentsAsBytes()), asset); + expect(utf8.decode(await bundle.entries[asset].contentsAsBytes()), asset); } }); diff --git a/packages/flutter_tools/test/base/build_test.dart b/packages/flutter_tools/test/base/build_test.dart index 53786efbf3..1c14819731 100644 --- a/packages/flutter_tools/test/base/build_test.dart +++ b/packages/flutter_tools/test/base/build_test.dart @@ -4,7 +4,7 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:convert' show JSON; +import 'dart:convert' show json; import 'package:file/memory.dart'; import 'package:flutter_tools/src/artifacts.dart'; @@ -95,26 +95,26 @@ void main() { await fs.file('b.dart').writeAsString('This is b'); final Fingerprint fingerprint = new Fingerprint.fromBuildInputs({}, ['a.dart', 'b.dart']); - final Map json = JSON.decode(fingerprint.toJson()); - expect(json['files'], hasLength(2)); - expect(json['files']['a.dart'], '8a21a15fad560b799f6731d436c1b698'); - expect(json['files']['b.dart'], '6f144e08b58cd0925328610fad7ac07c'); + final Map jsonObject = json.decode(fingerprint.toJson()); + expect(jsonObject['files'], hasLength(2)); + expect(jsonObject['files']['a.dart'], '8a21a15fad560b799f6731d436c1b698'); + expect(jsonObject['files']['b.dart'], '6f144e08b58cd0925328610fad7ac07c'); }, overrides: { FileSystem: () => fs }); testUsingContext('includes framework version', () { final Fingerprint fingerprint = new Fingerprint.fromBuildInputs({}, []); - final Map json = JSON.decode(fingerprint.toJson()); - expect(json['version'], mockVersion.frameworkRevision); + final Map jsonObject = json.decode(fingerprint.toJson()); + expect(jsonObject['version'], mockVersion.frameworkRevision); }, overrides: { FlutterVersion: () => mockVersion }); testUsingContext('includes provided properties', () { final Fingerprint fingerprint = new Fingerprint.fromBuildInputs({'a': 'A', 'b': 'B'}, []); - final Map json = JSON.decode(fingerprint.toJson()); - expect(json['properties'], hasLength(2)); - expect(json['properties']['a'], 'A'); - expect(json['properties']['b'], 'B'); + final Map jsonObject = json.decode(fingerprint.toJson()); + expect(jsonObject['properties'], hasLength(2)); + expect(jsonObject['properties']['a'], 'A'); + expect(jsonObject['properties']['b'], 'B'); }, overrides: { FlutterVersion: () => mockVersion }); }); @@ -126,7 +126,7 @@ void main() { }); testUsingContext('creates fingerprint from valid JSON', () async { - final String json = JSON.encode({ + final String jsonString = json.encode({ 'version': kVersion, 'properties': { 'buildMode': BuildMode.release.toString(), @@ -138,8 +138,8 @@ void main() { 'b.dart': '6f144e08b58cd0925328610fad7ac07c', }, }); - final Fingerprint fingerprint = new Fingerprint.fromJson(json); - final Map content = JSON.decode(fingerprint.toJson()); + final Fingerprint fingerprint = new Fingerprint.fromJson(jsonString); + final Map content = json.decode(fingerprint.toJson()); expect(content, hasLength(3)); expect(content['version'], mockVersion.frameworkRevision); expect(content['properties'], hasLength(3)); @@ -154,31 +154,31 @@ void main() { }); testUsingContext('throws ArgumentError for unknown versions', () async { - final String json = JSON.encode({ + final String jsonString = json.encode({ 'version': 'bad', 'properties':{}, 'files':{}, }); - expect(() => new Fingerprint.fromJson(json), throwsArgumentError); + expect(() => new Fingerprint.fromJson(jsonString), throwsArgumentError); }, overrides: { FlutterVersion: () => mockVersion, }); testUsingContext('throws ArgumentError if version is not present', () async { - final String json = JSON.encode({ + final String jsonString = json.encode({ 'properties':{}, 'files':{}, }); - expect(() => new Fingerprint.fromJson(json), throwsArgumentError); + expect(() => new Fingerprint.fromJson(jsonString), throwsArgumentError); }, overrides: { FlutterVersion: () => mockVersion, }); testUsingContext('treats missing properties and files entries as if empty', () async { - final String json = JSON.encode({ + final String jsonString = json.encode({ 'version': kVersion, }); - expect(new Fingerprint.fromJson(json), new Fingerprint.fromBuildInputs({}, [])); + expect(new Fingerprint.fromJson(jsonString), new Fingerprint.fromBuildInputs({}, [])); }, overrides: { FlutterVersion: () => mockVersion, }); @@ -197,7 +197,7 @@ void main() { b['properties'] = { 'buildMode': BuildMode.release.toString(), }; - expect(new Fingerprint.fromJson(JSON.encode(a)) == new Fingerprint.fromJson(JSON.encode(b)), isFalse); + expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(b)), isFalse); }, overrides: { FlutterVersion: () => mockVersion, }); @@ -216,7 +216,7 @@ void main() { 'a.dart': '8a21a15fad560b799f6731d436c1b698', 'b.dart': '6f144e08b58cd0925328610fad7ac07d', }; - expect(new Fingerprint.fromJson(JSON.encode(a)) == new Fingerprint.fromJson(JSON.encode(b)), isFalse); + expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(b)), isFalse); }, overrides: { FlutterVersion: () => mockVersion, }); @@ -235,7 +235,7 @@ void main() { 'a.dart': '8a21a15fad560b799f6731d436c1b698', 'c.dart': '6f144e08b58cd0925328610fad7ac07d', }; - expect(new Fingerprint.fromJson(JSON.encode(a)) == new Fingerprint.fromJson(JSON.encode(b)), isFalse); + expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(b)), isFalse); }, overrides: { FlutterVersion: () => mockVersion, }); @@ -253,7 +253,7 @@ void main() { 'b.dart': '6f144e08b58cd0925328610fad7ac07c', }, }; - expect(new Fingerprint.fromJson(JSON.encode(a)) == new Fingerprint.fromJson(JSON.encode(a)), isTrue); + expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(a)), isTrue); }, overrides: { FlutterVersion: () => mockVersion, }); @@ -344,7 +344,7 @@ void main() { }; Future writeFingerprint({ Map files = const {} }) { - return fs.file('output.snapshot.d.fingerprint').writeAsString(JSON.encode({ + return fs.file('output.snapshot.d.fingerprint').writeAsString(json.encode({ 'version': kVersion, 'properties': { 'buildMode': BuildMode.debug.toString(), @@ -371,14 +371,14 @@ void main() { String entryPoint: 'main.dart', Map checksums = const {}, }) { - final Map json = JSON.decode(fs.file('output.snapshot.d.fingerprint').readAsStringSync()); - expect(json['properties']['entryPoint'], entryPoint); - expect(json['files'], hasLength(checksums.length + 2)); + final Map jsonObject = json.decode(fs.file('output.snapshot.d.fingerprint').readAsStringSync()); + expect(jsonObject['properties']['entryPoint'], entryPoint); + expect(jsonObject['files'], hasLength(checksums.length + 2)); checksums.forEach((String path, String checksum) { - expect(json['files'][path], checksum); + expect(jsonObject['files'][path], checksum); }); - expect(json['files'][kVmSnapshotData], '2ec34912477a46c03ddef07e8b909b46'); - expect(json['files'][kIsolateSnapshotData], '621b3844bb7d4d17d2cfc5edf9a91c4c'); + expect(jsonObject['files'][kVmSnapshotData], '2ec34912477a46c03ddef07e8b909b46'); + expect(jsonObject['files'][kIsolateSnapshotData], '621b3844bb7d4d17d2cfc5edf9a91c4c'); } testUsingContext('builds snapshot and fingerprint when no fingerprint is present', () async { diff --git a/packages/flutter_tools/test/commands/config_test.dart b/packages/flutter_tools/test/commands/config_test.dart index c096e3e0e9..9485201cf1 100644 --- a/packages/flutter_tools/test/commands/config_test.dart +++ b/packages/flutter_tools/test/commands/config_test.dart @@ -30,14 +30,14 @@ void main() { await command.handleMachine(); expect(logger.statusText, isNotEmpty); - final dynamic json = JSON.decode(logger.statusText); - expect(json, isMap); + final dynamic jsonObject = json.decode(logger.statusText); + expect(jsonObject, isMap); - expect(json.containsKey('android-studio-dir'), true); - expect(json['android-studio-dir'], isNotNull); + expect(jsonObject.containsKey('android-studio-dir'), true); + expect(jsonObject['android-studio-dir'], isNotNull); - expect(json.containsKey('android-sdk'), true); - expect(json['android-sdk'], isNotNull); + expect(jsonObject.containsKey('android-sdk'), true); + expect(jsonObject['android-sdk'], isNotNull); }, overrides: { AndroidStudio: () => mockAndroidStudio, AndroidSdk: () => mockAndroidSdk, diff --git a/packages/flutter_tools/test/commands/create_test.dart b/packages/flutter_tools/test/commands/create_test.dart index a21ec7be0e..5c1e2d4931 100644 --- a/packages/flutter_tools/test/commands/create_test.dart +++ b/packages/flutter_tools/test/commands/create_test.dart @@ -207,7 +207,7 @@ void main() { [file.path], workingDirectory: projectDir.path, ); - final String formatted = await process.stdout.transform(UTF8.decoder).join(); + final String formatted = await process.stdout.transform(utf8.decoder).join(); expect(original, formatted, reason: file.path); } diff --git a/packages/flutter_tools/test/compile_test.dart b/packages/flutter_tools/test/compile_test.dart index 36f3847114..45e0bb9e67 100644 --- a/packages/flutter_tools/test/compile_test.dart +++ b/packages/flutter_tools/test/compile_test.dart @@ -41,7 +41,7 @@ void main() { final BufferLogger logger = context[Logger]; when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => new Stream>.fromFuture( - new Future>.value(UTF8.encode( + new Future>.value(utf8.encode( 'result abc\nline1\nline2\nabc /path/to/main.dart.dill' )) )); @@ -60,7 +60,7 @@ void main() { when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => new Stream>.fromFuture( - new Future>.value(UTF8.encode( + new Future>.value(utf8.encode( 'result abc\nline1\nline2\nabc' )) )); @@ -82,7 +82,7 @@ void main() { when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => new Stream>.fromFuture( - new Future>.value(UTF8.encode( + new Future>.value(utf8.encode( 'result abc\nline1\nline2\nabc' )) )); @@ -134,7 +134,7 @@ void main() { when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => new Stream>.fromFuture( - new Future>.value(UTF8.encode( + new Future>.value(utf8.encode( 'result abc\nline1\nline2\nabc /path/to/main.dart.dill' )) )); @@ -169,7 +169,7 @@ void main() { final StreamController> streamController = new StreamController>(); when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => streamController.stream); - streamController.add(UTF8.encode('result abc\nline0\nline1\nabc /path/to/main.dart.dill\n')); + streamController.add(utf8.encode('result abc\nline0\nline1\nabc /path/to/main.dart.dill\n')); await generator.recompile('/path/to/main.dart', null /* invalidatedFiles */); expect(mockFrontendServerStdIn.getAndClear(), 'compile /path/to/main.dart\n'); @@ -192,7 +192,7 @@ void main() { final StreamController> streamController = new StreamController>(); when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => streamController.stream); - streamController.add(UTF8.encode( + streamController.add(utf8.encode( 'result abc\nline0\nline1\nabc /path/to/main.dart.dill\n' )); await generator.recompile('/path/to/main.dart', null /* invalidatedFiles */); @@ -222,7 +222,7 @@ Future _recompile(StreamController> streamController, // Put content into the output stream after generator.recompile gets // going few lines below, resets completer. new Future>(() { - streamController.add(UTF8.encode(mockCompilerOutput)); + streamController.add(utf8.encode(mockCompilerOutput)); }); final String output = await generator.recompile(null /* mainPath */, ['/path/to/main.dart']); expect(output, equals('/path/to/main.dart.dill')); diff --git a/packages/flutter_tools/test/crash_reporting_test.dart b/packages/flutter_tools/test/crash_reporting_test.dart index 2416d25dd0..de3b23d85f 100644 --- a/packages/flutter_tools/test/crash_reporting_test.dart +++ b/packages/flutter_tools/test/crash_reporting_test.dart @@ -53,7 +53,7 @@ void main() { String boundary = request.headers['Content-Type']; boundary = boundary.substring(boundary.indexOf('boundary=') + 9); fields = new Map.fromIterable( - UTF8.decode(request.bodyBytes) + utf8.decode(request.bodyBytes) .split('--$boundary') .map>((String part) { final Match nameMatch = new RegExp(r'name="(.*)"').firstMatch(part); diff --git a/packages/flutter_tools/test/devfs_test.dart b/packages/flutter_tools/test/devfs_test.dart index 6252f45eb0..01eba00e0a 100644 --- a/packages/flutter_tools/test/devfs_test.dart +++ b/packages/flutter_tools/test/devfs_test.dart @@ -49,17 +49,17 @@ void main() { test('string', () { final DevFSStringContent content = new DevFSStringContent('some string'); expect(content.string, 'some string'); - expect(content.bytes, orderedEquals(UTF8.encode('some string'))); + expect(content.bytes, orderedEquals(utf8.encode('some string'))); expect(content.isModified, isTrue); expect(content.isModified, isFalse); content.string = 'another string'; expect(content.string, 'another string'); - expect(content.bytes, orderedEquals(UTF8.encode('another string'))); + expect(content.bytes, orderedEquals(utf8.encode('another string'))); expect(content.isModified, isTrue); expect(content.isModified, isFalse); - content.bytes = UTF8.encode('foo bar'); + content.bytes = utf8.encode('foo bar'); expect(content.string, 'foo bar'); - expect(content.bytes, orderedEquals(UTF8.encode('foo bar'))); + expect(content.bytes, orderedEquals(utf8.encode('foo bar'))); expect(content.isModified, isTrue); expect(content.isModified, isFalse); }); @@ -97,7 +97,7 @@ void main() { ]); expect(devFS.assetPathsToEvict, isEmpty); - final List packageSpecOnDevice = LineSplitter.split(UTF8.decode( + final List packageSpecOnDevice = LineSplitter.split(utf8.decode( await devFSOperations.devicePathToContent[fs.path.toUri('.packages')].contentsAsBytes() )).toList(); expect(packageSpecOnDevice, @@ -397,7 +397,7 @@ class MockVMService extends BasicMock implements VMService { } _server.listen((HttpRequest request) { final String fsName = request.headers.value('dev_fs_name'); - final String devicePath = UTF8.decode(BASE64.decode(request.headers.value('dev_fs_uri_b64'))); + final String devicePath = utf8.decode(base64.decode(request.headers.value('dev_fs_uri_b64'))); messages.add('writeFile $fsName $devicePath'); request.drain>().then((List value) { request.response diff --git a/packages/flutter_tools/test/ios/code_signing_test.dart b/packages/flutter_tools/test/ios/code_signing_test.dart index 82e04a9104..015eb1d1b8 100644 --- a/packages/flutter_tools/test/ios/code_signing_test.dart +++ b/packages/flutter_tools/test/ios/code_signing_test.dart @@ -125,7 +125,7 @@ void main() { when(mockProcess.stdin).thenReturn(mockStdIn); when(mockProcess.stdout) .thenAnswer((Invocation invocation) => new Stream>.fromFuture( - new Future>.value(UTF8.encode( + new Future>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 1 (1111AAAA11)/OU=3333CCCC33/O=My Team/C=US' )) )); @@ -184,7 +184,7 @@ void main() { when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) .thenAnswer((Invocation invocation) => new Stream>.fromFuture( - new Future>.value(UTF8.encode( + new Future>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 3 (3333CCCC33)/OU=4444DDDD44/O=My Team/C=US' )) )); @@ -254,7 +254,7 @@ void main() { when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) .thenAnswer((Invocation invocation) => new Stream>.fromFuture( - new Future>.value(UTF8.encode( + new Future>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 1 (1111AAAA11)/OU=5555EEEE55/O=My Team/C=US' )), )); @@ -316,7 +316,7 @@ void main() { when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) .thenAnswer((Invocation invocation) => new Stream>.fromFuture( - new Future>.value(UTF8.encode( + new Future>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 3 (3333CCCC33)/OU=4444DDDD44/O=My Team/C=US' )) )); @@ -385,7 +385,7 @@ void main() { when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) .thenAnswer((Invocation invocation) => new Stream>.fromFuture( - new Future>.value(UTF8.encode( + new Future>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 3 (3333CCCC33)/OU=4444DDDD44/O=My Team/C=US' )) )); diff --git a/packages/flutter_tools/test/ios/devices_test.dart b/packages/flutter_tools/test/ios/devices_test.dart index 60e9914acd..099e7afdea 100644 --- a/packages/flutter_tools/test/ios/devices_test.dart +++ b/packages/flutter_tools/test/ios/devices_test.dart @@ -107,7 +107,7 @@ f577a7903cc54959be2e34bc4f7f80b7009efcf4 .thenAnswer((Invocation invocation) => const Stream>.empty()); // Delay return of exitCode until after stdout stream data, since it terminates the logger. when(mockProcess.exitCode) - .thenAnswer((Invocation invocation) => new Future.delayed(Duration.ZERO, () => 0)); + .thenAnswer((Invocation invocation) => new Future.delayed(Duration.zero, () => 0)); return new Future.value(mockProcess); }); diff --git a/packages/flutter_tools/test/ios/simulators_test.dart b/packages/flutter_tools/test/ios/simulators_test.dart index 9ef1cf43ff..d717f96924 100644 --- a/packages/flutter_tools/test/ios/simulators_test.dart +++ b/packages/flutter_tools/test/ios/simulators_test.dart @@ -289,7 +289,7 @@ void main() { .thenAnswer((Invocation invocation) => const Stream>.empty()); // Delay return of exitCode until after stdout stream data, since it terminates the logger. when(mockProcess.exitCode) - .thenAnswer((Invocation invocation) => new Future.delayed(Duration.ZERO, () => 0)); + .thenAnswer((Invocation invocation) => new Future.delayed(Duration.zero, () => 0)); return new Future.value(mockProcess); }) .thenThrow(new TestFailure('Should start one process only')); diff --git a/packages/flutter_tools/test/src/mocks.dart b/packages/flutter_tools/test/src/mocks.dart index 6c29a5e87e..d7e4a1c49b 100644 --- a/packages/flutter_tools/test/src/mocks.dart +++ b/packages/flutter_tools/test/src/mocks.dart @@ -169,13 +169,13 @@ class MockProcess extends Mock implements Process { /// some lines to stdout before it exits. class PromptingProcess implements Process { Future showPrompt(String prompt, List outputLines) async { - _stdoutController.add(UTF8.encode(prompt)); + _stdoutController.add(utf8.encode(prompt)); final List bytesOnStdin = await _stdin.future; // Echo stdin to stdout. _stdoutController.add(bytesOnStdin); - if (bytesOnStdin[0] == UTF8.encode('y')[0]) { + if (bytesOnStdin[0] == utf8.encode('y')[0]) { for (final String line in outputLines) - _stdoutController.add(UTF8.encode('$line\n')); + _stdoutController.add(utf8.encode('$line\n')); } await _stdoutController.close(); } @@ -219,7 +219,7 @@ class CompleterIOSink extends MemoryIOSink { /// An IOSink that collects whatever is written to it. class MemoryIOSink implements IOSink { @override - Encoding encoding = UTF8; + Encoding encoding = utf8; final List> writes = >[]; @@ -291,7 +291,7 @@ class MockStdio extends Stdio { Stream> get stdin => _stdin.stream; void simulateStdin(String line) { - _stdin.add(UTF8.encode('$line\n')); + _stdin.add(utf8.encode('$line\n')); } List get writtenToStdout => _stdout.writes.map(_stdout.encoding.decode).toList(); diff --git a/packages/flutter_tools/test/version_test.dart b/packages/flutter_tools/test/version_test.dart index 331151d146..4e53722e19 100644 --- a/packages/flutter_tools/test/version_test.dart +++ b/packages/flutter_tools/test/version_test.dart @@ -30,7 +30,7 @@ void main() { setUpAll(() { Cache.disableLocking(); - FlutterVersion.kPauseToLetUserReadTheMessage = Duration.ZERO; + FlutterVersion.kPauseToLetUserReadTheMessage = Duration.zero; }); setUp(() { @@ -300,7 +300,7 @@ void fakeData({ return stampJson; if (stamp != null) - return JSON.encode(stamp.toJson()); + return json.encode(stamp.toJson()); return null; }); @@ -309,7 +309,7 @@ void fakeData({ expect(invocation.positionalArguments.first, VersionCheckStamp.kFlutterVersionCheckStampFile); if (expectSetStamp) { - stamp = VersionCheckStamp.fromJson(JSON.decode(invocation.positionalArguments[1])); + stamp = VersionCheckStamp.fromJson(json.decode(invocation.positionalArguments[1])); return null; } diff --git a/packages/flutter_tools/tool/daemon_client.dart b/packages/flutter_tools/tool/daemon_client.dart index 7516595935..150a74d1a4 100644 --- a/packages/flutter_tools/tool/daemon_client.dart +++ b/packages/flutter_tools/tool/daemon_client.dart @@ -21,13 +21,13 @@ Future main() async { print('daemon process started, pid: ${daemon.pid}'); daemon.stdout - .transform(UTF8.decoder) + .transform(utf8.decoder) .transform(const LineSplitter()) .listen((String line) => print('<== $line')); daemon.stderr.listen((dynamic data) => stderr.add(data)); stdout.write('> '); - stdin.transform(UTF8.decoder).transform(const LineSplitter()).listen((String line) { + stdin.transform(utf8.decoder).transform(const LineSplitter()).listen((String line) { final List words = line.split(' '); if (line == 'version' || line == 'v') { @@ -80,7 +80,7 @@ int id = 0; void _send(Map map) { map['id'] = id++; - final String str = '[${JSON.encode(map)}]'; + final String str = '[${json.encode(map)}]'; daemon.stdin.writeln(str); print('==> $str'); }