diff --git a/examples/layers/services/media_service.dart b/examples/layers/services/media_service.dart index 02e914f7f9..f7f234d36a 100644 --- a/examples/layers/services/media_service.dart +++ b/examples/layers/services/media_service.dart @@ -121,7 +121,7 @@ Widget splashScreen() { ); } -main() async { +Future main() async { runApp(splashScreen()); PianoApp app = new PianoApp(); diff --git a/examples/stocks/test_driver/scroll_perf_test.dart b/examples/stocks/test_driver/scroll_perf_test.dart index 62cb9e6dfd..f5ba03ac40 100644 --- a/examples/stocks/test_driver/scroll_perf_test.dart +++ b/examples/stocks/test_driver/scroll_perf_test.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'package:flutter_driver/flutter_driver.dart'; import 'package:test/test.dart'; -main() { +void main() { group('scrolling performance test', () { FlutterDriver driver; diff --git a/packages/cassowary/lib/param.dart b/packages/cassowary/lib/param.dart index 29ae254da1..81d349694d 100644 --- a/packages/cassowary/lib/param.dart +++ b/packages/cassowary/lib/param.dart @@ -23,7 +23,7 @@ class Param extends _EquationMember { double get value => variable.value; String get name => variable.name; - set name(String name) { variable.name = name; } + void set name(String name) { variable.name = name; } Expression asExpression() => new Expression([new Term(variable, 1.0)], 0.0); } diff --git a/packages/cassowary/lib/row.dart b/packages/cassowary/lib/row.dart index 5c49c0c78e..49b8fb9100 100644 --- a/packages/cassowary/lib/row.dart +++ b/packages/cassowary/lib/row.dart @@ -16,7 +16,7 @@ class _Row { double add(double value) => constant += value; void insertSymbol(_Symbol symbol, [double coefficient = 1.0]) { - double val = _elvis(cells[symbol], 0.0); + double val = cells[symbol] ?? 0.0; if (_nearZero(val + coefficient)) { cells.remove(symbol); @@ -52,7 +52,7 @@ class _Row { solveForSymbol(rhs); } - double coefficientForSymbol(_Symbol symbol) => _elvis(cells[symbol], 0.0); + double coefficientForSymbol(_Symbol symbol) => cells[symbol] ?? 0.0; void substitute(_Symbol symbol, _Row row) { double coefficient = cells[symbol]; diff --git a/packages/cassowary/lib/solver.dart b/packages/cassowary/lib/solver.dart index 35451a523f..4e551cf7c3 100644 --- a/packages/cassowary/lib/solver.dart +++ b/packages/cassowary/lib/solver.dart @@ -583,7 +583,7 @@ class Solver { } } - return _elvis(entering, new _Symbol(_SymbolType.invalid, 0)); + return entering ?? new _Symbol(_SymbolType.invalid, 0); } String toString() { diff --git a/packages/cassowary/lib/utils.dart b/packages/cassowary/lib/utils.dart index 699a6ae902..224e8e325a 100644 --- a/packages/cassowary/lib/utils.dart +++ b/packages/cassowary/lib/utils.dart @@ -9,11 +9,6 @@ bool _nearZero(double value) { return value < 0.0 ? -value < epsilon : value < epsilon; } -// Workaround for the lack of a null coalescing operator. Uses a ternary -// instead. Sadly, due the lack of generic types on functions, we have to use -// dynamic instead. -_elvis(a, b) => a != null ? a : b; - class _Pair { X first; Y second; diff --git a/packages/cassowary/lib/variable.dart b/packages/cassowary/lib/variable.dart index eca7948849..d362b87531 100644 --- a/packages/cassowary/lib/variable.dart +++ b/packages/cassowary/lib/variable.dart @@ -21,7 +21,7 @@ class Variable { return res; } - String get debugName => _elvis(name, 'variable$_tick'); + String get debugName => name ?? 'variable$_tick'; @override String toString() => debugName; diff --git a/packages/flutter/lib/src/widgets/binding.dart b/packages/flutter/lib/src/widgets/binding.dart index 0b353bc0dc..b0b8278bf8 100644 --- a/packages/flutter/lib/src/widgets/binding.dart +++ b/packages/flutter/lib/src/widgets/binding.dart @@ -35,7 +35,7 @@ class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, Service return _instance; } - initInstances() { + void initInstances() { super.initInstances(); _instance = this; BuildableElement.scheduleBuildFor = scheduleBuildFor; diff --git a/packages/flutter/lib/src/widgets/semantics_debugger.dart b/packages/flutter/lib/src/widgets/semantics_debugger.dart index 45e92506ee..8183b36a26 100644 --- a/packages/flutter/lib/src/widgets/semantics_debugger.dart +++ b/packages/flutter/lib/src/widgets/semantics_debugger.dart @@ -311,7 +311,7 @@ class _SemanticsDebuggerListener implements mojom.SemanticsListener { int generation = 0; - updateSemanticsTree(List nodes) { + void updateSemanticsTree(List nodes) { generation += 1; for (mojom.SemanticsNode node in nodes) _updateNode(node); diff --git a/packages/flutter/test/gestures/lsq_solver_test.dart b/packages/flutter/test/gestures/lsq_solver_test.dart index 08246b59e3..c1ed19164f 100644 --- a/packages/flutter/test/gestures/lsq_solver_test.dart +++ b/packages/flutter/test/gestures/lsq_solver_test.dart @@ -7,7 +7,7 @@ import 'package:test/test.dart'; void main() { - approx(double value, double expectation) { + bool approx(double value, double expectation) { const double eps = 1e-6; return (value - expectation).abs() < eps; } diff --git a/packages/flutter/test/widget/test_semantics.dart b/packages/flutter/test/widget/test_semantics.dart index 7eda783a4b..9fa4a32777 100644 --- a/packages/flutter/test/widget/test_semantics.dart +++ b/packages/flutter/test/widget/test_semantics.dart @@ -10,7 +10,7 @@ class TestSemanticsListener implements mojom.SemanticsListener { SemanticsNode.addListener(this); } final List updates = []; - updateSemanticsTree(List nodes) { + void updateSemanticsTree(List nodes) { assert(!nodes.any((mojom.SemanticsNode node) => node == null)); updates.addAll(nodes); updates.add(null); diff --git a/packages/flutter_driver/lib/src/find.dart b/packages/flutter_driver/lib/src/find.dart index 11715eb2f7..7e05334f32 100644 --- a/packages/flutter_driver/lib/src/find.dart +++ b/packages/flutter_driver/lib/src/find.dart @@ -7,6 +7,10 @@ import 'message.dart'; const List _supportedKeyValueTypes = const [String, int]; +DriverError _createInvalidKeyValueTypeError(String invalidType) { + return new DriverError('Unsupported key value type $invalidType. Flutter Driver only supports ${_supportedKeyValueTypes.join(", ")}'); +} + /// Command to find an element. class Find extends Command { final String kind = 'find'; @@ -20,10 +24,6 @@ class Find extends Command { static Find deserialize(Map json) { return new Find(SearchSpecification.deserialize(json)); } - - static _throwInvalidKeyValueType(String invalidType) { - throw new DriverError('Unsupported key value type $invalidType. Flutter Driver only supports ${_supportedKeyValueTypes.join(", ")}'); - } } /// Describes how to the driver should search for elements. @@ -89,7 +89,7 @@ class ByValueKey extends SearchSpecification { this.keyValueString = '$keyValue', this.keyValueType = '${keyValue.runtimeType}' { if (!_supportedKeyValueTypes.contains(keyValue.runtimeType)) - _throwInvalidKeyValueType('$keyValue.runtimeType'); + throw _createInvalidKeyValueTypeError('$keyValue.runtimeType'); } /// The true value of the key. @@ -117,13 +117,9 @@ class ByValueKey extends SearchSpecification { case 'String': return new ByValueKey(keyValueString); default: - return _throwInvalidKeyValueType(keyValueType); + throw _createInvalidKeyValueTypeError(keyValueType); } } - - static _throwInvalidKeyValueType(String invalidType) { - throw new DriverError('Unsupported key value type $invalidType. Flutter Driver only supports ${_supportedKeyValueTypes.join(", ")}'); - } } /// Command to read the text from a given element. diff --git a/packages/flutter_driver/lib/src/health.dart b/packages/flutter_driver/lib/src/health.dart index d46a302a9b..1fffbe9740 100644 --- a/packages/flutter_driver/lib/src/health.dart +++ b/packages/flutter_driver/lib/src/health.dart @@ -9,7 +9,7 @@ import 'message.dart'; class GetHealth implements Command { final String kind = 'get_health'; - static deserialize(Map json) => new GetHealth(); + static GetHealth deserialize(Map json) => new GetHealth(); Map serialize() => const {}; } diff --git a/packages/flutter_driver/test/flutter_driver_test.dart b/packages/flutter_driver/test/flutter_driver_test.dart index 4ed75da944..3d7c118f68 100644 --- a/packages/flutter_driver/test/flutter_driver_test.dart +++ b/packages/flutter_driver/test/flutter_driver_test.dart @@ -13,7 +13,7 @@ import 'package:mockito/mockito.dart'; import 'package:quiver/testing/async.dart'; import 'package:vm_service_client/vm_service_client.dart'; -main() { +void main() { group('FlutterDriver.connect', () { List log; StreamSubscription logSub; @@ -21,7 +21,7 @@ main() { MockVM mockVM; MockIsolate mockIsolate; - expectLogContains(String message) { + void expectLogContains(String message) { expect(log.map((r) => '$r'), anyElement(contains(message))); } diff --git a/packages/flutter_driver/test/retry_test.dart b/packages/flutter_driver/test/retry_test.dart index d1e6f40536..b4fa3fd424 100644 --- a/packages/flutter_driver/test/retry_test.dart +++ b/packages/flutter_driver/test/retry_test.dart @@ -9,7 +9,7 @@ import 'package:quiver/testing/time.dart'; import 'package:flutter_driver/src/retry.dart'; -main() { +void main() { group('retry', () { FakeAsync fakeAsync; diff --git a/packages/flutter_sprites/lib/src/action.dart b/packages/flutter_sprites/lib/src/action.dart index cd6915b647..fb1aa8a07c 100644 --- a/packages/flutter_sprites/lib/src/action.dart +++ b/packages/flutter_sprites/lib/src/action.dart @@ -125,7 +125,7 @@ class ActionRepeatForever extends Action { /// var myInifiniteLoop = new ActionRepeatForever(myAction); ActionRepeatForever(this.action); - step(double dt) { + void step(double dt) { _elapsedInAction += dt; while (_elapsedInAction > action.duration) { _elapsedInAction -= action.duration; diff --git a/packages/flutter_sprites/lib/src/effect_line.dart b/packages/flutter_sprites/lib/src/effect_line.dart index 9af90505dd..1f94fce6f1 100644 --- a/packages/flutter_sprites/lib/src/effect_line.dart +++ b/packages/flutter_sprites/lib/src/effect_line.dart @@ -67,7 +67,7 @@ class EffectLine extends Node { List get points => _points; - set points(List points) { + void set points(List points) { _points = points; _pointAges = []; for (int i = 0; i < _points.length; i++) { diff --git a/packages/flutter_sprites/lib/src/label.dart b/packages/flutter_sprites/lib/src/label.dart index 09bfa552c5..0318cdc599 100644 --- a/packages/flutter_sprites/lib/src/label.dart +++ b/packages/flutter_sprites/lib/src/label.dart @@ -15,7 +15,7 @@ class Label extends Node { /// The text being drawn by the label. String get text => _text; - set text(String text) { + void set text(String text) { _text = text; _painter = null; } @@ -25,7 +25,7 @@ class Label extends Node { /// The style to draw the text in. TextStyle get textStyle => _textStyle; - set textStyle(TextStyle textStyle) { + void set textStyle(TextStyle textStyle) { _textStyle = textStyle; _painter = null; } diff --git a/packages/flutter_sprites/lib/src/node.dart b/packages/flutter_sprites/lib/src/node.dart index 38052e1ff0..131e05cca6 100644 --- a/packages/flutter_sprites/lib/src/node.dart +++ b/packages/flutter_sprites/lib/src/node.dart @@ -85,7 +85,7 @@ class Node { return _constraints; } - set constraints(List constraints) { + void set constraints(List constraints) { _constraints = constraints; if (_spriteBox != null) _spriteBox._constrainedNodes = null; } @@ -803,7 +803,7 @@ class Node { /// ); PhysicsBody get physicsBody => _physicsBody; - set physicsBody(PhysicsBody physicsBody) { + void set physicsBody(PhysicsBody physicsBody) { if (parent != null) { assert(parent is PhysicsWorld); diff --git a/packages/flutter_sprites/lib/src/node3d.dart b/packages/flutter_sprites/lib/src/node3d.dart index 40fb629c28..1424a215b0 100644 --- a/packages/flutter_sprites/lib/src/node3d.dart +++ b/packages/flutter_sprites/lib/src/node3d.dart @@ -13,7 +13,7 @@ class Node3D extends Node { /// The node's rotation around the x axis in degrees. double get rotationX => _rotationX; - set rotationX(double rotationX) { + void set rotationX(double rotationX) { _rotationX = rotationX; invalidateTransformMatrix(); } @@ -23,7 +23,7 @@ class Node3D extends Node { /// The node's rotation around the y axis in degrees. double get rotationY => _rotationY; - set rotationY(double rotationY) { + void set rotationY(double rotationY) { _rotationY = rotationY; invalidateTransformMatrix(); } @@ -33,7 +33,7 @@ class Node3D extends Node { /// The projection depth. Default value is 500.0. double get projectionDepth => _projectionDepth; - set projectionDepth(double projectionDepth) { + void set projectionDepth(double projectionDepth) { _projectionDepth = projectionDepth; invalidateTransformMatrix(); } diff --git a/packages/flutter_sprites/lib/src/physics_body.dart b/packages/flutter_sprites/lib/src/physics_body.dart index 9afed576e3..f29636e028 100644 --- a/packages/flutter_sprites/lib/src/physics_body.dart +++ b/packages/flutter_sprites/lib/src/physics_body.dart @@ -91,7 +91,7 @@ class PhysicsBody { /// myBody.density = 0.5; double get density => _density; - set density(double density) { + void set density(double density) { _density = density; if (_body == null) @@ -109,7 +109,7 @@ class PhysicsBody { /// myBody.friction = 0.4; double get friction => _friction; - set friction(double friction) { + void set friction(double friction) { _friction = friction; if (_body == null) @@ -127,7 +127,7 @@ class PhysicsBody { /// the range of 0.0 to 1.0. /// /// myBody.restitution = 0.5; - set restitution(double restitution) { + void set restitution(double restitution) { _restitution = restitution; if (_body == null) @@ -146,7 +146,7 @@ class PhysicsBody { /// myBody.isSensor = true; bool get isSensor => _isSensor; - set isSensor(bool isSensor) { + void set isSensor(bool isSensor) { _isSensor = isSensor; if (_body == null) @@ -171,7 +171,7 @@ class PhysicsBody { } } - set linearVelocity(Offset linearVelocity) { + void set linearVelocity(Offset linearVelocity) { _linearVelocity = linearVelocity; if (_body != null) { @@ -195,7 +195,7 @@ class PhysicsBody { return _body.angularVelocity; } - set angularVelocity(double angularVelocity) { + void set angularVelocity(double angularVelocity) { _angularVelocity = angularVelocity; if (_body != null) { @@ -217,7 +217,7 @@ class PhysicsBody { /// myBody.angularDampening = 0.1; double get angularDampening => _angularDampening; - set angularDampening(double angularDampening) { + void set angularDampening(double angularDampening) { _angularDampening = angularDampening; if (_body != null) @@ -231,7 +231,7 @@ class PhysicsBody { /// myBody.allowSleep = false; bool get allowSleep => _allowSleep; - set allowSleep(bool allowSleep) { + void set allowSleep(bool allowSleep) { _allowSleep = allowSleep; if (_body != null) @@ -250,7 +250,7 @@ class PhysicsBody { return _awake; } - set awake(bool awake) { + void set awake(bool awake) { _awake = awake; if (_body != null) @@ -264,7 +264,7 @@ class PhysicsBody { /// myBody.fixedRotation = true; bool get fixedRotation => _fixedRotation; - set fixedRotation(bool fixedRotation) { + void set fixedRotation(bool fixedRotation) { _fixedRotation = fixedRotation; if (_body != null) @@ -280,7 +280,7 @@ class PhysicsBody { /// if neccessary. /// /// myBody.bullet = true; - set bullet(bool bullet) { + void set bullet(bool bullet) { _bullet = bullet; if (_body != null) { @@ -301,7 +301,7 @@ class PhysicsBody { return _active; } - set active(bool active) { + void set active(bool active) { _active = active; if (_body != null) @@ -321,7 +321,7 @@ class PhysicsBody { return _collisionCategory; } - set collisionCategory(Object collisionCategory) { + void set collisionCategory(Object collisionCategory) { _collisionCategory = collisionCategory; _updateFilter(); } @@ -334,7 +334,7 @@ class PhysicsBody { /// myBody.collisionMask = ["Air", "Ground"]; List get collisionMask => _collisionMask; - set collisionMask(List collisionMask) { + void set collisionMask(List collisionMask) { _collisionMask = collisionMask; _updateFilter(); } diff --git a/packages/flutter_sprites/lib/src/physics_group.dart b/packages/flutter_sprites/lib/src/physics_group.dart index a78b0d5e22..36cefa5f59 100644 --- a/packages/flutter_sprites/lib/src/physics_group.dart +++ b/packages/flutter_sprites/lib/src/physics_group.dart @@ -9,37 +9,37 @@ part of flutter_sprites; /// group.addChild(myNode); class PhysicsGroup extends Node { - set scaleX(double scaleX) { + void set scaleX(double scaleX) { assert(false); } - set scaleY(double scaleX) { + void set scaleY(double scaleX) { assert(false); } - set skewX(double scaleX) { + void set skewX(double scaleX) { assert(false); } - set skewY(double scaleX) { + void set skewY(double scaleX) { assert(false); } - set physicsBody(PhysicsBody body) { + void set physicsBody(PhysicsBody body) { assert(false); } - set position(Point position) { + void set position(Point position) { super.position = position; _invalidatePhysicsBodies(this); } - set rotation(double rotation) { + void set rotation(double rotation) { super.rotation = rotation; _invalidatePhysicsBodies(this); } - set scale(double scale) { + void set scale(double scale) { super.scale = scale; _invalidatePhysicsBodies(this); } diff --git a/packages/flutter_sprites/lib/src/physics_joint.dart b/packages/flutter_sprites/lib/src/physics_joint.dart index d5a0eefd9e..f409f4de5d 100644 --- a/packages/flutter_sprites/lib/src/physics_joint.dart +++ b/packages/flutter_sprites/lib/src/physics_joint.dart @@ -147,7 +147,7 @@ class PhysicsJointRevolute extends PhysicsJoint { /// useful you also need to set [motorSpeed] and [maxMotorTorque]. bool get enableMotor => _enableMotor; - set enableMotor(bool enableMotor) { + void set enableMotor(bool enableMotor) { _enableMotor = enableMotor; if (_joint != null) { box2d.RevoluteJoint revoluteJoint = _joint; @@ -161,7 +161,7 @@ class PhysicsJointRevolute extends PhysicsJoint { /// set to true and [maxMotorTorque] is set to a non zero value. double get motorSpeed => _motorSpeed; - set motorSpeed(double motorSpeed) { + void set motorSpeed(double motorSpeed) { _motorSpeed = motorSpeed; if (_joint != null) { box2d.RevoluteJoint revoluteJoint = _joint; @@ -175,7 +175,7 @@ class PhysicsJointRevolute extends PhysicsJoint { /// Sets the motor torque of this joint, will only work if [enableMotor] is /// set to true and [motorSpeed] is set to a non zero value. - set maxMotorTorque(double maxMotorTorque) { + void set maxMotorTorque(double maxMotorTorque) { _maxMotorTorque = maxMotorTorque; if (_joint != null) { box2d.RevoluteJoint revoluteJoint = _joint; @@ -252,7 +252,7 @@ class PhysicsJointPrismatic extends PhysicsJoint { /// [maxMotorForce]. bool get enableMotor => _enableMotor; - set enableMotor(bool enableMotor) { + void set enableMotor(bool enableMotor) { _enableMotor = enableMotor; if (_joint != null) { box2d.PrismaticJoint prismaticJoint = _joint; @@ -266,7 +266,7 @@ class PhysicsJointPrismatic extends PhysicsJoint { /// set to true and [maxMotorForce] is set to a non zero value. double get motorSpeed => _motorSpeed; - set motorSpeed(double motorSpeed) { + void set motorSpeed(double motorSpeed) { _motorSpeed = motorSpeed; if (_joint != null) { box2d.PrismaticJoint prismaticJoint = _joint; @@ -280,7 +280,7 @@ class PhysicsJointPrismatic extends PhysicsJoint { /// set to true and [motorSpeed] is set to a non zero value. double get maxMotorForce => _maxMotorForce; - set maxMotorForce(double maxMotorForce) { + void set maxMotorForce(double maxMotorForce) { _maxMotorForce = maxMotorForce; if (_joint != null) { box2d.PrismaticJoint prismaticJoint = _joint; diff --git a/packages/flutter_sprites/lib/src/physics_world.dart b/packages/flutter_sprites/lib/src/physics_world.dart index 561ca08be4..8ab8e1a676 100644 --- a/packages/flutter_sprites/lib/src/physics_world.dart +++ b/packages/flutter_sprites/lib/src/physics_world.dart @@ -74,7 +74,7 @@ class PhysicsWorld extends Node { return new Offset(g.x, g.y); } - set gravity(Offset gravity) { + void set gravity(Offset gravity) { // Convert from points/s^2 to m/s^2 b2World.setGravity(new Vector2(gravity.dx / b2WorldToNodeConversionFactor, gravity.dy / b2WorldToNodeConversionFactor)); @@ -83,14 +83,14 @@ class PhysicsWorld extends Node { /// If set to true, objects can fall asleep if the haven't moved in a while. bool get allowSleep => b2World.isAllowSleep(); - set allowSleep(bool allowSleep) { + void set allowSleep(bool allowSleep) { b2World.setAllowSleep(allowSleep); } /// True if sub stepping should be used in the simulation. bool get subStepping => b2World.isSubStepping(); - set subStepping(bool subStepping) { + void set subStepping(bool subStepping) { b2World.setSubStepping(subStepping); } diff --git a/packages/flutter_sprites/lib/src/sound.dart b/packages/flutter_sprites/lib/src/sound.dart index 76395b0d6f..6be942db13 100644 --- a/packages/flutter_sprites/lib/src/sound.dart +++ b/packages/flutter_sprites/lib/src/sound.dart @@ -137,11 +137,8 @@ SoundTrackPlayer _sharedSoundTrackPlayer; class SoundTrackPlayer { Set _soundTracks = new HashSet(); - static sharedInstance() { - if (_sharedSoundTrackPlayer == null) { - _sharedSoundTrackPlayer = new SoundTrackPlayer(); - } - return _sharedSoundTrackPlayer; + static SoundTrackPlayer sharedInstance() { + return _sharedSoundTrackPlayer ??= new SoundTrackPlayer(); } SoundTrackPlayer() { diff --git a/packages/flutter_sprites/lib/src/sprite_box.dart b/packages/flutter_sprites/lib/src/sprite_box.dart index 20dbc49b94..25685a6b99 100644 --- a/packages/flutter_sprites/lib/src/sprite_box.dart +++ b/packages/flutter_sprites/lib/src/sprite_box.dart @@ -38,7 +38,8 @@ class SpriteBox extends RenderBox { || value.size.height > 0); // Remove sprite box references - if (_rootNode != null) _removeSpriteBoxReference(_rootNode); + if (_rootNode != null) + _removeSpriteBoxReference(_rootNode); // Update the value _rootNode = value; @@ -374,7 +375,7 @@ class SpriteBox extends RenderBox { double delta = (timeStamp - _lastTimeStamp).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; _lastTimeStamp = timeStamp; - _frameRate = 1.0/delta; + _frameRate = 1.0 / delta; if (_initialized) { _callConstraintsPreUpdate(delta); @@ -497,7 +498,7 @@ class SpriteBox extends RenderBox { return nodes; } - _addNodesAtPosition(Node node, Point position, List list) { + void _addNodesAtPosition(Node node, Point position, List list) { // Visit children first for (Node child in node.children) { _addNodesAtPosition(child, position, list); diff --git a/packages/flutter_sprites/lib/src/textured_line.dart b/packages/flutter_sprites/lib/src/textured_line.dart index 2cbe95fdd5..11c70f08f5 100644 --- a/packages/flutter_sprites/lib/src/textured_line.dart +++ b/packages/flutter_sprites/lib/src/textured_line.dart @@ -21,7 +21,7 @@ class TexturedLinePainter { List get points => _points; - set points(List points) { + void set points(List points) { _points = points; _calculatedTextureStops = null; } @@ -32,7 +32,7 @@ class TexturedLinePainter { Texture get texture => _texture; - set texture(Texture texture) { + void set texture(Texture texture) { _texture = texture; if (texture == null) { _cachedPaint = new Paint(); @@ -68,9 +68,9 @@ class TexturedLinePainter { double _textureLoopLength; - get textureLoopLength => textureLoopLength; + double get textureLoopLength => textureLoopLength; - set textureLoopLength(double textureLoopLength) { + void set textureLoopLength(double textureLoopLength) { _textureLoopLength = textureLoopLength; _calculatedTextureStops = null; } diff --git a/packages/flutter_tools/bin/flutter_tools.dart b/packages/flutter_tools/bin/flutter_tools.dart index 482239c9b1..762e6a5e96 100644 --- a/packages/flutter_tools/bin/flutter_tools.dart +++ b/packages/flutter_tools/bin/flutter_tools.dart @@ -4,4 +4,6 @@ import 'package:flutter_tools/executable.dart' as executable; -main(List args) => executable.main(args); +void main(List args) { + executable.main(args); +} diff --git a/packages/flutter_tools/lib/src/android/adb.dart b/packages/flutter_tools/lib/src/android/adb.dart index 0320b3c152..e8b648eb21 100644 --- a/packages/flutter_tools/lib/src/android/adb.dart +++ b/packages/flutter_tools/lib/src/android/adb.dart @@ -204,7 +204,7 @@ class AdbDevice { /// Device model; can be null. `XT1045`, `Nexus_7` String get modelID => _info['model']; - set modelID(String value) { + void set modelID(String value) { _info['model'] = value; } diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart index 220c6399fa..c6afb1b399 100644 --- a/packages/flutter_tools/lib/src/commands/analyze.dart +++ b/packages/flutter_tools/lib/src/commands/analyze.dart @@ -288,6 +288,7 @@ analyzer: todo: ignore linter: rules: + - always_declare_return_types # we'll turn on avoid_as as soon as it doesn't complain about "as dynamic" # - avoid_as - camel_case_types diff --git a/packages/flutter_tools/test/adb_test.dart b/packages/flutter_tools/test/adb_test.dart index f8b505c251..168085bfa6 100644 --- a/packages/flutter_tools/test/adb_test.dart +++ b/packages/flutter_tools/test/adb_test.dart @@ -5,9 +5,7 @@ import 'package:flutter_tools/src/android/adb.dart'; import 'package:test/test.dart'; -main() => defineTests(); - -defineTests() { +void main() { Adb adb = new Adb('adb'); // We only test the [Adb] class is we're able to locate the adb binary. diff --git a/packages/flutter_tools/test/analyze_test.dart b/packages/flutter_tools/test/analyze_test.dart index 9ff1be262f..bddf95fcaf 100644 --- a/packages/flutter_tools/test/analyze_test.dart +++ b/packages/flutter_tools/test/analyze_test.dart @@ -14,9 +14,7 @@ import 'package:test/test.dart'; import 'src/context.dart'; -main() => defineTests(); - -defineTests() { +void main() { AnalysisServer server; Directory tempDir; diff --git a/packages/flutter_tools/test/android_device_test.dart b/packages/flutter_tools/test/android_device_test.dart index 2ad4701e2d..be140721aa 100644 --- a/packages/flutter_tools/test/android_device_test.dart +++ b/packages/flutter_tools/test/android_device_test.dart @@ -7,9 +7,7 @@ import 'package:test/test.dart'; import 'src/context.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('android_device', () { testUsingContext('stores the requested id', () { String deviceId = '1234'; diff --git a/packages/flutter_tools/test/base_utils_test.dart b/packages/flutter_tools/test/base_utils_test.dart index 053fdd4307..ad5a47d982 100644 --- a/packages/flutter_tools/test/base_utils_test.dart +++ b/packages/flutter_tools/test/base_utils_test.dart @@ -7,9 +7,7 @@ import 'dart:async'; import 'package:flutter_tools/src/base/utils.dart'; import 'package:test/test.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('ItemListNotifier', () { test('sends notifications', () async { ItemListNotifier list = new ItemListNotifier(); diff --git a/packages/flutter_tools/test/context_test.dart b/packages/flutter_tools/test/context_test.dart index 1de58405d4..8141909618 100644 --- a/packages/flutter_tools/test/context_test.dart +++ b/packages/flutter_tools/test/context_test.dart @@ -7,9 +7,7 @@ import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/globals.dart'; import 'package:test/test.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('DeviceManager', () { test('error', () async { AppContext context = new AppContext(); diff --git a/packages/flutter_tools/test/create_test.dart b/packages/flutter_tools/test/create_test.dart index 84e337d91b..703f8c6a1b 100644 --- a/packages/flutter_tools/test/create_test.dart +++ b/packages/flutter_tools/test/create_test.dart @@ -13,9 +13,7 @@ import 'package:test/test.dart'; import 'src/context.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('create', () { Directory temp; diff --git a/packages/flutter_tools/test/daemon_test.dart b/packages/flutter_tools/test/daemon_test.dart index 9f986fc4f6..fa345315b6 100644 --- a/packages/flutter_tools/test/daemon_test.dart +++ b/packages/flutter_tools/test/daemon_test.dart @@ -17,9 +17,7 @@ import 'package:test/test.dart'; import 'src/context.dart'; import 'src/mocks.dart'; -main() => defineTests(); - -defineTests() { +void main() { Daemon daemon; AppContext appContext; NotifyingLogger notifyingLogger; diff --git a/packages/flutter_tools/test/device_test.dart b/packages/flutter_tools/test/device_test.dart index 3ea8f09c5a..2bb2fb75f7 100644 --- a/packages/flutter_tools/test/device_test.dart +++ b/packages/flutter_tools/test/device_test.dart @@ -7,9 +7,7 @@ import 'package:test/test.dart'; import 'src/context.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('DeviceManager', () { testUsingContext('getDevices', () async { // Test that DeviceManager.getDevices() doesn't throw. diff --git a/packages/flutter_tools/test/devices.test.dart b/packages/flutter_tools/test/devices.test.dart index 767d4cecd8..49660c75de 100644 --- a/packages/flutter_tools/test/devices.test.dart +++ b/packages/flutter_tools/test/devices.test.dart @@ -10,9 +10,7 @@ import 'package:test/test.dart'; import 'src/common.dart'; import 'src/context.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('devices', () { testUsingContext('returns 0 when called', () { DevicesCommand command = new DevicesCommand(); diff --git a/packages/flutter_tools/test/drive_test.dart b/packages/flutter_tools/test/drive_test.dart index f95f76c564..62c14f6938 100644 --- a/packages/flutter_tools/test/drive_test.dart +++ b/packages/flutter_tools/test/drive_test.dart @@ -20,9 +20,7 @@ import 'src/common.dart'; import 'src/context.dart'; import 'src/mocks.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('drive', () { DriveCommand command; Device mockDevice; @@ -182,7 +180,7 @@ defineTests() { }); group('findTargetDevice on iOS', () { - setOs() { + void setOs() { when(os.isMacOS).thenReturn(true); when(os.isLinux).thenReturn(false); } @@ -222,7 +220,7 @@ defineTests() { }); group('findTargetDevice on Linux', () { - setOs() { + void setOs() { when(os.isMacOS).thenReturn(false); when(os.isLinux).thenReturn(true); } diff --git a/packages/flutter_tools/test/install_test.dart b/packages/flutter_tools/test/install_test.dart index fc7d2fd313..aaa6186ec4 100644 --- a/packages/flutter_tools/test/install_test.dart +++ b/packages/flutter_tools/test/install_test.dart @@ -10,9 +10,7 @@ import 'src/common.dart'; import 'src/context.dart'; import 'src/mocks.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('install', () { testUsingContext('returns 0 when Android is connected and ready for an install', () { InstallCommand command = new InstallCommand(); diff --git a/packages/flutter_tools/test/listen_test.dart b/packages/flutter_tools/test/listen_test.dart index 701dc24be6..56bac434a8 100644 --- a/packages/flutter_tools/test/listen_test.dart +++ b/packages/flutter_tools/test/listen_test.dart @@ -9,9 +9,7 @@ import 'src/common.dart'; import 'src/context.dart'; import 'src/mocks.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('listen', () { testUsingContext('returns 1 when no device is connected', () { ListenCommand command = new ListenCommand(singleRun: true); diff --git a/packages/flutter_tools/test/logs_test.dart b/packages/flutter_tools/test/logs_test.dart index ba5bdc9932..ef99320ebf 100644 --- a/packages/flutter_tools/test/logs_test.dart +++ b/packages/flutter_tools/test/logs_test.dart @@ -9,9 +9,7 @@ import 'src/common.dart'; import 'src/context.dart'; import 'src/mocks.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('logs', () { testUsingContext('fail with a bad device id', () { LogsCommand command = new LogsCommand(); diff --git a/packages/flutter_tools/test/os_utils_test.dart b/packages/flutter_tools/test/os_utils_test.dart index 9dacd2f51c..87a7c285fd 100644 --- a/packages/flutter_tools/test/os_utils_test.dart +++ b/packages/flutter_tools/test/os_utils_test.dart @@ -8,9 +8,7 @@ import 'package:flutter_tools/src/base/os.dart'; import 'package:path/path.dart' as path; import 'package:test/test.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('OperatingSystemUtils', () { Directory temp; diff --git a/packages/flutter_tools/test/run_test.dart b/packages/flutter_tools/test/run_test.dart index 8c07516a5a..4f7c7e9a7e 100644 --- a/packages/flutter_tools/test/run_test.dart +++ b/packages/flutter_tools/test/run_test.dart @@ -9,9 +9,7 @@ import 'src/common.dart'; import 'src/context.dart'; import 'src/mocks.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('run', () { testUsingContext('fails when target not found', () { RunCommand command = new RunCommand(); diff --git a/packages/flutter_tools/test/service_protocol_test.dart b/packages/flutter_tools/test/service_protocol_test.dart index 7c62e57011..3498b5c2f6 100644 --- a/packages/flutter_tools/test/service_protocol_test.dart +++ b/packages/flutter_tools/test/service_protocol_test.dart @@ -9,9 +9,7 @@ import 'package:flutter_tools/src/service_protocol.dart'; import 'src/mocks.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('service_protocol', () { test('Discovery Heartbeat', () async { MockDeviceLogReader logReader = new MockDeviceLogReader(); diff --git a/packages/flutter_tools/test/stop_test.dart b/packages/flutter_tools/test/stop_test.dart index 112a9fc1ae..d3c5f31c00 100644 --- a/packages/flutter_tools/test/stop_test.dart +++ b/packages/flutter_tools/test/stop_test.dart @@ -12,9 +12,7 @@ import 'src/common.dart'; import 'src/context.dart'; import 'src/mocks.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('stop', () { testUsingContext('returns 0 when Android is connected and ready to be stopped', () { StopCommand command = new StopCommand(); diff --git a/packages/flutter_tools/test/trace_test.dart b/packages/flutter_tools/test/trace_test.dart index 5fc2cd75f6..e9870679a9 100644 --- a/packages/flutter_tools/test/trace_test.dart +++ b/packages/flutter_tools/test/trace_test.dart @@ -9,9 +9,7 @@ import 'src/common.dart'; import 'src/context.dart'; import 'src/mocks.dart'; -main() => defineTests(); - -defineTests() { +void main() { group('trace', () { testUsingContext('returns 1 when no Android device is connected', () { TraceCommand command = new TraceCommand(); diff --git a/packages/flx/test/bundle_test.dart b/packages/flx/test/bundle_test.dart index a54ccfe242..521502aea4 100644 --- a/packages/flx/test/bundle_test.dart +++ b/packages/flx/test/bundle_test.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:convert' hide BASE64; import 'dart:io'; import 'dart:typed_data'; @@ -7,7 +8,7 @@ import 'package:flx/bundle.dart'; import 'package:flx/signing.dart'; import 'package:test/test.dart'; -main() async { +Future main() async { // The following constant was generated via the openssl shell commands: // openssl ecparam -genkey -name prime256v1 -out privatekey.pem // openssl ec -in privatekey.pem -outform DER | base64 diff --git a/packages/flx/test/signing_test.dart b/packages/flx/test/signing_test.dart index 46e746ea30..585ca797c4 100644 --- a/packages/flx/test/signing_test.dart +++ b/packages/flx/test/signing_test.dart @@ -8,7 +8,7 @@ import 'package:crypto/crypto.dart'; import 'package:flx/signing.dart'; import 'package:test/test.dart'; -main() async { +Future main() async { // The following constant was generated via the openssl shell commands: // openssl ecparam -genkey -name prime256v1 -out privatekey.pem // openssl ec -in privatekey.pem -outform DER | base64