Enable always_declare_return_types lint
And fix a zillion omissions this uncovered.
diff --git a/examples/layers/services/media_service.dart b/examples/layers/services/media_service.dart
index 02e914f..f7f234d 100644
--- a/examples/layers/services/media_service.dart
+++ b/examples/layers/services/media_service.dart
@@ -121,7 +121,7 @@
);
}
-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 62cb9e6..f5ba03a 100644
--- a/examples/stocks/test_driver/scroll_perf_test.dart
+++ b/examples/stocks/test_driver/scroll_perf_test.dart
@@ -6,7 +6,7 @@
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 29ae254..81d3496 100644
--- a/packages/cassowary/lib/param.dart
+++ b/packages/cassowary/lib/param.dart
@@ -23,7 +23,7 @@
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 5c49c0c..49b8fb9 100644
--- a/packages/cassowary/lib/row.dart
+++ b/packages/cassowary/lib/row.dart
@@ -16,7 +16,7 @@
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 @@
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 35451a5..4e551cf 100644
--- a/packages/cassowary/lib/solver.dart
+++ b/packages/cassowary/lib/solver.dart
@@ -583,7 +583,7 @@
}
}
- 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 699a6ae..224e8e3 100644
--- a/packages/cassowary/lib/utils.dart
+++ b/packages/cassowary/lib/utils.dart
@@ -9,11 +9,6 @@
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, Y> {
X first;
Y second;
diff --git a/packages/cassowary/lib/variable.dart b/packages/cassowary/lib/variable.dart
index eca7948..d362b87 100644
--- a/packages/cassowary/lib/variable.dart
+++ b/packages/cassowary/lib/variable.dart
@@ -21,7 +21,7 @@
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 0b353bc..b0b8278 100644
--- a/packages/flutter/lib/src/widgets/binding.dart
+++ b/packages/flutter/lib/src/widgets/binding.dart
@@ -35,7 +35,7 @@
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 45e9250..8183b36 100644
--- a/packages/flutter/lib/src/widgets/semantics_debugger.dart
+++ b/packages/flutter/lib/src/widgets/semantics_debugger.dart
@@ -311,7 +311,7 @@
int generation = 0;
- updateSemanticsTree(List<mojom.SemanticsNode> nodes) {
+ void updateSemanticsTree(List<mojom.SemanticsNode> 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 08246b5..c1ed191 100644
--- a/packages/flutter/test/gestures/lsq_solver_test.dart
+++ b/packages/flutter/test/gestures/lsq_solver_test.dart
@@ -7,7 +7,7 @@
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 7eda783..9fa4a32 100644
--- a/packages/flutter/test/widget/test_semantics.dart
+++ b/packages/flutter/test/widget/test_semantics.dart
@@ -10,7 +10,7 @@
SemanticsNode.addListener(this);
}
final List<mojom.SemanticsNode> updates = <mojom.SemanticsNode>[];
- updateSemanticsTree(List<mojom.SemanticsNode> nodes) {
+ void updateSemanticsTree(List<mojom.SemanticsNode> 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 11715eb..7e05334 100644
--- a/packages/flutter_driver/lib/src/find.dart
+++ b/packages/flutter_driver/lib/src/find.dart
@@ -7,6 +7,10 @@
const List<Type> _supportedKeyValueTypes = const <Type>[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 @@
static Find deserialize(Map<String, String> 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 @@
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 @@
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 d46a302..1fffbe9 100644
--- a/packages/flutter_driver/lib/src/health.dart
+++ b/packages/flutter_driver/lib/src/health.dart
@@ -9,7 +9,7 @@
class GetHealth implements Command {
final String kind = 'get_health';
- static deserialize(Map<String, String> json) => new GetHealth();
+ static GetHealth deserialize(Map<String, String> json) => new GetHealth();
Map<String, String> serialize() => const {};
}
diff --git a/packages/flutter_driver/test/flutter_driver_test.dart b/packages/flutter_driver/test/flutter_driver_test.dart
index 4ed75da..3d7c118 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:quiver/testing/async.dart';
import 'package:vm_service_client/vm_service_client.dart';
-main() {
+void main() {
group('FlutterDriver.connect', () {
List<LogRecord> log;
StreamSubscription logSub;
@@ -21,7 +21,7 @@
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 d1e6f40..b4fa3fd 100644
--- a/packages/flutter_driver/test/retry_test.dart
+++ b/packages/flutter_driver/test/retry_test.dart
@@ -9,7 +9,7 @@
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 cd6915b..fb1aa8a 100644
--- a/packages/flutter_sprites/lib/src/action.dart
+++ b/packages/flutter_sprites/lib/src/action.dart
@@ -125,7 +125,7 @@
/// 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 9af9050..1f94fce 100644
--- a/packages/flutter_sprites/lib/src/effect_line.dart
+++ b/packages/flutter_sprites/lib/src/effect_line.dart
@@ -67,7 +67,7 @@
List<Point> get points => _points;
- set points(List<Point> points) {
+ void set points(List<Point> points) {
_points = points;
_pointAges = <double>[];
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 09bfa55..0318cdc 100644
--- a/packages/flutter_sprites/lib/src/label.dart
+++ b/packages/flutter_sprites/lib/src/label.dart
@@ -15,7 +15,7 @@
/// 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 @@
/// 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 38052e1..131e05c 100644
--- a/packages/flutter_sprites/lib/src/node.dart
+++ b/packages/flutter_sprites/lib/src/node.dart
@@ -85,7 +85,7 @@
return _constraints;
}
- set constraints(List<Constraint> constraints) {
+ void set constraints(List<Constraint> constraints) {
_constraints = constraints;
if (_spriteBox != null) _spriteBox._constrainedNodes = null;
}
@@ -803,7 +803,7 @@
/// );
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 40fb629..1424a21 100644
--- a/packages/flutter_sprites/lib/src/node3d.dart
+++ b/packages/flutter_sprites/lib/src/node3d.dart
@@ -13,7 +13,7 @@
/// 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 @@
/// 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 @@
/// 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 9afed57..f29636e 100644
--- a/packages/flutter_sprites/lib/src/physics_body.dart
+++ b/packages/flutter_sprites/lib/src/physics_body.dart
@@ -91,7 +91,7 @@
/// 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 @@
/// 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 @@
/// 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 @@
/// 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 @@
}
}
- set linearVelocity(Offset linearVelocity) {
+ void set linearVelocity(Offset linearVelocity) {
_linearVelocity = linearVelocity;
if (_body != null) {
@@ -195,7 +195,7 @@
return _body.angularVelocity;
}
- set angularVelocity(double angularVelocity) {
+ void set angularVelocity(double angularVelocity) {
_angularVelocity = angularVelocity;
if (_body != null) {
@@ -217,7 +217,7 @@
/// 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 @@
/// 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 @@
return _awake;
}
- set awake(bool awake) {
+ void set awake(bool awake) {
_awake = awake;
if (_body != null)
@@ -264,7 +264,7 @@
/// 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 @@
/// if neccessary.
///
/// myBody.bullet = true;
- set bullet(bool bullet) {
+ void set bullet(bool bullet) {
_bullet = bullet;
if (_body != null) {
@@ -301,7 +301,7 @@
return _active;
}
- set active(bool active) {
+ void set active(bool active) {
_active = active;
if (_body != null)
@@ -321,7 +321,7 @@
return _collisionCategory;
}
- set collisionCategory(Object collisionCategory) {
+ void set collisionCategory(Object collisionCategory) {
_collisionCategory = collisionCategory;
_updateFilter();
}
@@ -334,7 +334,7 @@
/// myBody.collisionMask = ["Air", "Ground"];
List<Object> get collisionMask => _collisionMask;
- set collisionMask(List<Object> collisionMask) {
+ void set collisionMask(List<Object> 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 a78b0d5e..36cefa5 100644
--- a/packages/flutter_sprites/lib/src/physics_group.dart
+++ b/packages/flutter_sprites/lib/src/physics_group.dart
@@ -9,37 +9,37 @@
/// 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 d5a0eef..f409f4d 100644
--- a/packages/flutter_sprites/lib/src/physics_joint.dart
+++ b/packages/flutter_sprites/lib/src/physics_joint.dart
@@ -147,7 +147,7 @@
/// 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 @@
/// 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 @@
/// 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 @@
/// [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 @@
/// 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 @@
/// 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 561ca08..8ab8e1a 100644
--- a/packages/flutter_sprites/lib/src/physics_world.dart
+++ b/packages/flutter_sprites/lib/src/physics_world.dart
@@ -74,7 +74,7 @@
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 @@
/// 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 76395b0..6be942d 100644
--- a/packages/flutter_sprites/lib/src/sound.dart
+++ b/packages/flutter_sprites/lib/src/sound.dart
@@ -137,11 +137,8 @@
class SoundTrackPlayer {
Set<SoundTrack> _soundTracks = new HashSet<SoundTrack>();
- 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 20dbc49..25685a6 100644
--- a/packages/flutter_sprites/lib/src/sprite_box.dart
+++ b/packages/flutter_sprites/lib/src/sprite_box.dart
@@ -38,7 +38,8 @@
|| 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 @@
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 @@
return nodes;
}
- _addNodesAtPosition(Node node, Point position, List<Node> list) {
+ void _addNodesAtPosition(Node node, Point position, List<Node> 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 2cbe95f..11c70f0 100644
--- a/packages/flutter_sprites/lib/src/textured_line.dart
+++ b/packages/flutter_sprites/lib/src/textured_line.dart
@@ -21,7 +21,7 @@
List<Point> get points => _points;
- set points(List<Point> points) {
+ void set points(List<Point> points) {
_points = points;
_calculatedTextureStops = null;
}
@@ -32,7 +32,7 @@
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 @@
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 482239c..762e6a5 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<String> args) => executable.main(args);
+void main(List<String> 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 0320b3c..e8b648e 100644
--- a/packages/flutter_tools/lib/src/android/adb.dart
+++ b/packages/flutter_tools/lib/src/android/adb.dart
@@ -204,7 +204,7 @@
/// 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 220c639..c6afb1b 100644
--- a/packages/flutter_tools/lib/src/commands/analyze.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze.dart
@@ -288,6 +288,7 @@
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 f8b505c..168085b 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 9ff1be2..bddf95f 100644
--- a/packages/flutter_tools/test/analyze_test.dart
+++ b/packages/flutter_tools/test/analyze_test.dart
@@ -14,9 +14,7 @@
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 2ad4701..be14072 100644
--- a/packages/flutter_tools/test/android_device_test.dart
+++ b/packages/flutter_tools/test/android_device_test.dart
@@ -7,9 +7,7 @@
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 053fdd4..ad5a47d 100644
--- a/packages/flutter_tools/test/base_utils_test.dart
+++ b/packages/flutter_tools/test/base_utils_test.dart
@@ -7,9 +7,7 @@
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<String> list = new ItemListNotifier<String>();
diff --git a/packages/flutter_tools/test/context_test.dart b/packages/flutter_tools/test/context_test.dart
index 1de5840..8141909 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/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 84e337d..703f8c6 100644
--- a/packages/flutter_tools/test/create_test.dart
+++ b/packages/flutter_tools/test/create_test.dart
@@ -13,9 +13,7 @@
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 9f986fc..fa34531 100644
--- a/packages/flutter_tools/test/daemon_test.dart
+++ b/packages/flutter_tools/test/daemon_test.dart
@@ -17,9 +17,7 @@
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 3ea8f09..2bb2fb7 100644
--- a/packages/flutter_tools/test/device_test.dart
+++ b/packages/flutter_tools/test/device_test.dart
@@ -7,9 +7,7 @@
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 767d4ce..49660c7 100644
--- a/packages/flutter_tools/test/devices.test.dart
+++ b/packages/flutter_tools/test/devices.test.dart
@@ -10,9 +10,7 @@
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 f95f76c..62c14f6 100644
--- a/packages/flutter_tools/test/drive_test.dart
+++ b/packages/flutter_tools/test/drive_test.dart
@@ -20,9 +20,7 @@
import 'src/context.dart';
import 'src/mocks.dart';
-main() => defineTests();
-
-defineTests() {
+void main() {
group('drive', () {
DriveCommand command;
Device mockDevice;
@@ -182,7 +180,7 @@
});
group('findTargetDevice on iOS', () {
- setOs() {
+ void setOs() {
when(os.isMacOS).thenReturn(true);
when(os.isLinux).thenReturn(false);
}
@@ -222,7 +220,7 @@
});
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 fc7d2fd..aaa6186 100644
--- a/packages/flutter_tools/test/install_test.dart
+++ b/packages/flutter_tools/test/install_test.dart
@@ -10,9 +10,7 @@
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 701dc24..56bac43 100644
--- a/packages/flutter_tools/test/listen_test.dart
+++ b/packages/flutter_tools/test/listen_test.dart
@@ -9,9 +9,7 @@
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 ba5bdc9..ef99320 100644
--- a/packages/flutter_tools/test/logs_test.dart
+++ b/packages/flutter_tools/test/logs_test.dart
@@ -9,9 +9,7 @@
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 9dacd2f..87a7c28 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: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 8c07516..4f7c7e9 100644
--- a/packages/flutter_tools/test/run_test.dart
+++ b/packages/flutter_tools/test/run_test.dart
@@ -9,9 +9,7 @@
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 7c62e57..3498b5c 100644
--- a/packages/flutter_tools/test/service_protocol_test.dart
+++ b/packages/flutter_tools/test/service_protocol_test.dart
@@ -9,9 +9,7 @@
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 112a9fc..d3c5f31 100644
--- a/packages/flutter_tools/test/stop_test.dart
+++ b/packages/flutter_tools/test/stop_test.dart
@@ -12,9 +12,7 @@
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 5fc2cd7..e987067 100644
--- a/packages/flutter_tools/test/trace_test.dart
+++ b/packages/flutter_tools/test/trace_test.dart
@@ -9,9 +9,7 @@
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 a54ccfe..521502a 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/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 46e746e..585ca79 100644
--- a/packages/flx/test/signing_test.dart
+++ b/packages/flx/test/signing_test.dart
@@ -8,7 +8,7 @@
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