Commit b6ff67cc authored by Ian Hickson's avatar Ian Hickson

Merge pull request #2568 from Hixie/always_declare_return_types

Enable always_declare_return_types lint
parents bdc83886 c7339de6
...@@ -121,7 +121,7 @@ Widget splashScreen() { ...@@ -121,7 +121,7 @@ Widget splashScreen() {
); );
} }
main() async { Future main() async {
runApp(splashScreen()); runApp(splashScreen());
PianoApp app = new PianoApp(); PianoApp app = new PianoApp();
......
...@@ -6,7 +6,7 @@ import 'dart:async'; ...@@ -6,7 +6,7 @@ import 'dart:async';
import 'package:flutter_driver/flutter_driver.dart'; import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
main() { void main() {
group('scrolling performance test', () { group('scrolling performance test', () {
FlutterDriver driver; FlutterDriver driver;
......
...@@ -23,7 +23,7 @@ class Param extends _EquationMember { ...@@ -23,7 +23,7 @@ class Param extends _EquationMember {
double get value => variable.value; double get value => variable.value;
String get name => variable.name; 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); Expression asExpression() => new Expression([new Term(variable, 1.0)], 0.0);
} }
...@@ -16,7 +16,7 @@ class _Row { ...@@ -16,7 +16,7 @@ class _Row {
double add(double value) => constant += value; double add(double value) => constant += value;
void insertSymbol(_Symbol symbol, [double coefficient = 1.0]) { 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)) { if (_nearZero(val + coefficient)) {
cells.remove(symbol); cells.remove(symbol);
...@@ -52,7 +52,7 @@ class _Row { ...@@ -52,7 +52,7 @@ class _Row {
solveForSymbol(rhs); 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) { void substitute(_Symbol symbol, _Row row) {
double coefficient = cells[symbol]; double coefficient = cells[symbol];
......
...@@ -583,7 +583,7 @@ class Solver { ...@@ -583,7 +583,7 @@ class Solver {
} }
} }
return _elvis(entering, new _Symbol(_SymbolType.invalid, 0)); return entering ?? new _Symbol(_SymbolType.invalid, 0);
} }
String toString() { String toString() {
......
...@@ -9,11 +9,6 @@ bool _nearZero(double value) { ...@@ -9,11 +9,6 @@ bool _nearZero(double value) {
return value < 0.0 ? -value < epsilon : value < epsilon; 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> { class _Pair<X, Y> {
X first; X first;
Y second; Y second;
......
...@@ -21,7 +21,7 @@ class Variable { ...@@ -21,7 +21,7 @@ class Variable {
return res; return res;
} }
String get debugName => _elvis(name, 'variable$_tick'); String get debugName => name ?? 'variable$_tick';
@override @override
String toString() => debugName; String toString() => debugName;
......
...@@ -35,7 +35,7 @@ class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, Service ...@@ -35,7 +35,7 @@ class WidgetFlutterBinding extends BindingBase with Scheduler, Gesturer, Service
return _instance; return _instance;
} }
initInstances() { void initInstances() {
super.initInstances(); super.initInstances();
_instance = this; _instance = this;
BuildableElement.scheduleBuildFor = scheduleBuildFor; BuildableElement.scheduleBuildFor = scheduleBuildFor;
......
...@@ -311,7 +311,7 @@ class _SemanticsDebuggerListener implements mojom.SemanticsListener { ...@@ -311,7 +311,7 @@ class _SemanticsDebuggerListener implements mojom.SemanticsListener {
int generation = 0; int generation = 0;
updateSemanticsTree(List<mojom.SemanticsNode> nodes) { void updateSemanticsTree(List<mojom.SemanticsNode> nodes) {
generation += 1; generation += 1;
for (mojom.SemanticsNode node in nodes) for (mojom.SemanticsNode node in nodes)
_updateNode(node); _updateNode(node);
......
...@@ -7,7 +7,7 @@ import 'package:test/test.dart'; ...@@ -7,7 +7,7 @@ import 'package:test/test.dart';
void main() { void main() {
approx(double value, double expectation) { bool approx(double value, double expectation) {
const double eps = 1e-6; const double eps = 1e-6;
return (value - expectation).abs() < eps; return (value - expectation).abs() < eps;
} }
......
...@@ -10,7 +10,7 @@ class TestSemanticsListener implements mojom.SemanticsListener { ...@@ -10,7 +10,7 @@ class TestSemanticsListener implements mojom.SemanticsListener {
SemanticsNode.addListener(this); SemanticsNode.addListener(this);
} }
final List<mojom.SemanticsNode> updates = <mojom.SemanticsNode>[]; 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)); assert(!nodes.any((mojom.SemanticsNode node) => node == null));
updates.addAll(nodes); updates.addAll(nodes);
updates.add(null); updates.add(null);
......
...@@ -7,6 +7,10 @@ import 'message.dart'; ...@@ -7,6 +7,10 @@ import 'message.dart';
const List<Type> _supportedKeyValueTypes = const <Type>[String, int]; 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. /// Command to find an element.
class Find extends Command { class Find extends Command {
final String kind = 'find'; final String kind = 'find';
...@@ -20,10 +24,6 @@ class Find extends Command { ...@@ -20,10 +24,6 @@ class Find extends Command {
static Find deserialize(Map<String, String> json) { static Find deserialize(Map<String, String> json) {
return new Find(SearchSpecification.deserialize(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. /// Describes how to the driver should search for elements.
...@@ -89,7 +89,7 @@ class ByValueKey extends SearchSpecification { ...@@ -89,7 +89,7 @@ class ByValueKey extends SearchSpecification {
this.keyValueString = '$keyValue', this.keyValueString = '$keyValue',
this.keyValueType = '${keyValue.runtimeType}' { this.keyValueType = '${keyValue.runtimeType}' {
if (!_supportedKeyValueTypes.contains(keyValue.runtimeType)) if (!_supportedKeyValueTypes.contains(keyValue.runtimeType))
_throwInvalidKeyValueType('$keyValue.runtimeType'); throw _createInvalidKeyValueTypeError('$keyValue.runtimeType');
} }
/// The true value of the key. /// The true value of the key.
...@@ -117,13 +117,9 @@ class ByValueKey extends SearchSpecification { ...@@ -117,13 +117,9 @@ class ByValueKey extends SearchSpecification {
case 'String': case 'String':
return new ByValueKey(keyValueString); return new ByValueKey(keyValueString);
default: 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. /// Command to read the text from a given element.
......
...@@ -9,7 +9,7 @@ import 'message.dart'; ...@@ -9,7 +9,7 @@ import 'message.dart';
class GetHealth implements Command { class GetHealth implements Command {
final String kind = 'get_health'; 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 {}; Map<String, String> serialize() => const {};
} }
......
...@@ -13,7 +13,7 @@ import 'package:mockito/mockito.dart'; ...@@ -13,7 +13,7 @@ import 'package:mockito/mockito.dart';
import 'package:quiver/testing/async.dart'; import 'package:quiver/testing/async.dart';
import 'package:vm_service_client/vm_service_client.dart'; import 'package:vm_service_client/vm_service_client.dart';
main() { void main() {
group('FlutterDriver.connect', () { group('FlutterDriver.connect', () {
List<LogRecord> log; List<LogRecord> log;
StreamSubscription logSub; StreamSubscription logSub;
...@@ -21,7 +21,7 @@ main() { ...@@ -21,7 +21,7 @@ main() {
MockVM mockVM; MockVM mockVM;
MockIsolate mockIsolate; MockIsolate mockIsolate;
expectLogContains(String message) { void expectLogContains(String message) {
expect(log.map((r) => '$r'), anyElement(contains(message))); expect(log.map((r) => '$r'), anyElement(contains(message)));
} }
......
...@@ -9,7 +9,7 @@ import 'package:quiver/testing/time.dart'; ...@@ -9,7 +9,7 @@ import 'package:quiver/testing/time.dart';
import 'package:flutter_driver/src/retry.dart'; import 'package:flutter_driver/src/retry.dart';
main() { void main() {
group('retry', () { group('retry', () {
FakeAsync fakeAsync; FakeAsync fakeAsync;
......
...@@ -125,7 +125,7 @@ class ActionRepeatForever extends Action { ...@@ -125,7 +125,7 @@ class ActionRepeatForever extends Action {
/// var myInifiniteLoop = new ActionRepeatForever(myAction); /// var myInifiniteLoop = new ActionRepeatForever(myAction);
ActionRepeatForever(this.action); ActionRepeatForever(this.action);
step(double dt) { void step(double dt) {
_elapsedInAction += dt; _elapsedInAction += dt;
while (_elapsedInAction > action.duration) { while (_elapsedInAction > action.duration) {
_elapsedInAction -= action.duration; _elapsedInAction -= action.duration;
......
...@@ -67,7 +67,7 @@ class EffectLine extends Node { ...@@ -67,7 +67,7 @@ class EffectLine extends Node {
List<Point> get points => _points; List<Point> get points => _points;
set points(List<Point> points) { void set points(List<Point> points) {
_points = points; _points = points;
_pointAges = <double>[]; _pointAges = <double>[];
for (int i = 0; i < _points.length; i++) { for (int i = 0; i < _points.length; i++) {
......
...@@ -15,7 +15,7 @@ class Label extends Node { ...@@ -15,7 +15,7 @@ class Label extends Node {
/// The text being drawn by the label. /// The text being drawn by the label.
String get text => _text; String get text => _text;
set text(String text) { void set text(String text) {
_text = text; _text = text;
_painter = null; _painter = null;
} }
...@@ -25,7 +25,7 @@ class Label extends Node { ...@@ -25,7 +25,7 @@ class Label extends Node {
/// The style to draw the text in. /// The style to draw the text in.
TextStyle get textStyle => _textStyle; TextStyle get textStyle => _textStyle;
set textStyle(TextStyle textStyle) { void set textStyle(TextStyle textStyle) {
_textStyle = textStyle; _textStyle = textStyle;
_painter = null; _painter = null;
} }
......
...@@ -85,7 +85,7 @@ class Node { ...@@ -85,7 +85,7 @@ class Node {
return _constraints; return _constraints;
} }
set constraints(List<Constraint> constraints) { void set constraints(List<Constraint> constraints) {
_constraints = constraints; _constraints = constraints;
if (_spriteBox != null) _spriteBox._constrainedNodes = null; if (_spriteBox != null) _spriteBox._constrainedNodes = null;
} }
...@@ -803,7 +803,7 @@ class Node { ...@@ -803,7 +803,7 @@ class Node {
/// ); /// );
PhysicsBody get physicsBody => _physicsBody; PhysicsBody get physicsBody => _physicsBody;
set physicsBody(PhysicsBody physicsBody) { void set physicsBody(PhysicsBody physicsBody) {
if (parent != null) { if (parent != null) {
assert(parent is PhysicsWorld); assert(parent is PhysicsWorld);
......
...@@ -13,7 +13,7 @@ class Node3D extends Node { ...@@ -13,7 +13,7 @@ class Node3D extends Node {
/// The node's rotation around the x axis in degrees. /// The node's rotation around the x axis in degrees.
double get rotationX => _rotationX; double get rotationX => _rotationX;
set rotationX(double rotationX) { void set rotationX(double rotationX) {
_rotationX = rotationX; _rotationX = rotationX;
invalidateTransformMatrix(); invalidateTransformMatrix();
} }
...@@ -23,7 +23,7 @@ class Node3D extends Node { ...@@ -23,7 +23,7 @@ class Node3D extends Node {
/// The node's rotation around the y axis in degrees. /// The node's rotation around the y axis in degrees.
double get rotationY => _rotationY; double get rotationY => _rotationY;
set rotationY(double rotationY) { void set rotationY(double rotationY) {
_rotationY = rotationY; _rotationY = rotationY;
invalidateTransformMatrix(); invalidateTransformMatrix();
} }
...@@ -33,7 +33,7 @@ class Node3D extends Node { ...@@ -33,7 +33,7 @@ class Node3D extends Node {
/// The projection depth. Default value is 500.0. /// The projection depth. Default value is 500.0.
double get projectionDepth => _projectionDepth; double get projectionDepth => _projectionDepth;
set projectionDepth(double projectionDepth) { void set projectionDepth(double projectionDepth) {
_projectionDepth = projectionDepth; _projectionDepth = projectionDepth;
invalidateTransformMatrix(); invalidateTransformMatrix();
} }
......
...@@ -91,7 +91,7 @@ class PhysicsBody { ...@@ -91,7 +91,7 @@ class PhysicsBody {
/// myBody.density = 0.5; /// myBody.density = 0.5;
double get density => _density; double get density => _density;
set density(double density) { void set density(double density) {
_density = density; _density = density;
if (_body == null) if (_body == null)
...@@ -109,7 +109,7 @@ class PhysicsBody { ...@@ -109,7 +109,7 @@ class PhysicsBody {
/// myBody.friction = 0.4; /// myBody.friction = 0.4;
double get friction => _friction; double get friction => _friction;
set friction(double friction) { void set friction(double friction) {
_friction = friction; _friction = friction;
if (_body == null) if (_body == null)
...@@ -127,7 +127,7 @@ class PhysicsBody { ...@@ -127,7 +127,7 @@ class PhysicsBody {
/// the range of 0.0 to 1.0. /// the range of 0.0 to 1.0.
/// ///
/// myBody.restitution = 0.5; /// myBody.restitution = 0.5;
set restitution(double restitution) { void set restitution(double restitution) {
_restitution = restitution; _restitution = restitution;
if (_body == null) if (_body == null)
...@@ -146,7 +146,7 @@ class PhysicsBody { ...@@ -146,7 +146,7 @@ class PhysicsBody {
/// myBody.isSensor = true; /// myBody.isSensor = true;
bool get isSensor => _isSensor; bool get isSensor => _isSensor;
set isSensor(bool isSensor) { void set isSensor(bool isSensor) {
_isSensor = isSensor; _isSensor = isSensor;
if (_body == null) if (_body == null)
...@@ -171,7 +171,7 @@ class PhysicsBody { ...@@ -171,7 +171,7 @@ class PhysicsBody {
} }
} }
set linearVelocity(Offset linearVelocity) { void set linearVelocity(Offset linearVelocity) {
_linearVelocity = linearVelocity; _linearVelocity = linearVelocity;
if (_body != null) { if (_body != null) {
...@@ -195,7 +195,7 @@ class PhysicsBody { ...@@ -195,7 +195,7 @@ class PhysicsBody {
return _body.angularVelocity; return _body.angularVelocity;
} }
set angularVelocity(double angularVelocity) { void set angularVelocity(double angularVelocity) {
_angularVelocity = angularVelocity; _angularVelocity = angularVelocity;
if (_body != null) { if (_body != null) {
...@@ -217,7 +217,7 @@ class PhysicsBody { ...@@ -217,7 +217,7 @@ class PhysicsBody {
/// myBody.angularDampening = 0.1; /// myBody.angularDampening = 0.1;
double get angularDampening => _angularDampening; double get angularDampening => _angularDampening;
set angularDampening(double angularDampening) { void set angularDampening(double angularDampening) {
_angularDampening = angularDampening; _angularDampening = angularDampening;
if (_body != null) if (_body != null)
...@@ -231,7 +231,7 @@ class PhysicsBody { ...@@ -231,7 +231,7 @@ class PhysicsBody {
/// myBody.allowSleep = false; /// myBody.allowSleep = false;
bool get allowSleep => _allowSleep; bool get allowSleep => _allowSleep;
set allowSleep(bool allowSleep) { void set allowSleep(bool allowSleep) {
_allowSleep = allowSleep; _allowSleep = allowSleep;
if (_body != null) if (_body != null)
...@@ -250,7 +250,7 @@ class PhysicsBody { ...@@ -250,7 +250,7 @@ class PhysicsBody {
return _awake; return _awake;
} }
set awake(bool awake) { void set awake(bool awake) {
_awake = awake; _awake = awake;
if (_body != null) if (_body != null)
...@@ -264,7 +264,7 @@ class PhysicsBody { ...@@ -264,7 +264,7 @@ class PhysicsBody {
/// myBody.fixedRotation = true; /// myBody.fixedRotation = true;
bool get fixedRotation => _fixedRotation; bool get fixedRotation => _fixedRotation;
set fixedRotation(bool fixedRotation) { void set fixedRotation(bool fixedRotation) {
_fixedRotation = fixedRotation; _fixedRotation = fixedRotation;
if (_body != null) if (_body != null)
...@@ -280,7 +280,7 @@ class PhysicsBody { ...@@ -280,7 +280,7 @@ class PhysicsBody {
/// if neccessary. /// if neccessary.
/// ///
/// myBody.bullet = true; /// myBody.bullet = true;
set bullet(bool bullet) { void set bullet(bool bullet) {
_bullet = bullet; _bullet = bullet;
if (_body != null) { if (_body != null) {
...@@ -301,7 +301,7 @@ class PhysicsBody { ...@@ -301,7 +301,7 @@ class PhysicsBody {
return _active; return _active;
} }
set active(bool active) { void set active(bool active) {
_active = active; _active = active;
if (_body != null) if (_body != null)
...@@ -321,7 +321,7 @@ class PhysicsBody { ...@@ -321,7 +321,7 @@ class PhysicsBody {
return _collisionCategory; return _collisionCategory;
} }
set collisionCategory(Object collisionCategory) { void set collisionCategory(Object collisionCategory) {
_collisionCategory = collisionCategory; _collisionCategory = collisionCategory;
_updateFilter(); _updateFilter();
} }
...@@ -334,7 +334,7 @@ class PhysicsBody { ...@@ -334,7 +334,7 @@ class PhysicsBody {
/// myBody.collisionMask = ["Air", "Ground"]; /// myBody.collisionMask = ["Air", "Ground"];
List<Object> get collisionMask => _collisionMask; List<Object> get collisionMask => _collisionMask;
set collisionMask(List<Object> collisionMask) { void set collisionMask(List<Object> collisionMask) {
_collisionMask = collisionMask; _collisionMask = collisionMask;
_updateFilter(); _updateFilter();
} }
......
...@@ -9,37 +9,37 @@ part of flutter_sprites; ...@@ -9,37 +9,37 @@ part of flutter_sprites;
/// group.addChild(myNode); /// group.addChild(myNode);
class PhysicsGroup extends Node { class PhysicsGroup extends Node {
set scaleX(double scaleX) { void set scaleX(double scaleX) {
assert(false); assert(false);
} }
set scaleY(double scaleX) { void set scaleY(double scaleX) {
assert(false); assert(false);
} }
set skewX(double scaleX) { void set skewX(double scaleX) {
assert(false); assert(false);
} }
set skewY(double scaleX) { void set skewY(double scaleX) {
assert(false); assert(false);
} }
set physicsBody(PhysicsBody body) { void set physicsBody(PhysicsBody body) {
assert(false); assert(false);
} }
set position(Point position) { void set position(Point position) {
super.position = position; super.position = position;
_invalidatePhysicsBodies(this); _invalidatePhysicsBodies(this);
} }
set rotation(double rotation) { void set rotation(double rotation) {
super.rotation = rotation; super.rotation = rotation;
_invalidatePhysicsBodies(this); _invalidatePhysicsBodies(this);
} }
set scale(double scale) { void set scale(double scale) {
super.scale = scale; super.scale = scale;
_invalidatePhysicsBodies(this); _invalidatePhysicsBodies(this);
} }
......
...@@ -147,7 +147,7 @@ class PhysicsJointRevolute extends PhysicsJoint { ...@@ -147,7 +147,7 @@ class PhysicsJointRevolute extends PhysicsJoint {
/// useful you also need to set [motorSpeed] and [maxMotorTorque]. /// useful you also need to set [motorSpeed] and [maxMotorTorque].
bool get enableMotor => _enableMotor; bool get enableMotor => _enableMotor;
set enableMotor(bool enableMotor) { void set enableMotor(bool enableMotor) {
_enableMotor = enableMotor; _enableMotor = enableMotor;
if (_joint != null) { if (_joint != null) {
box2d.RevoluteJoint revoluteJoint = _joint; box2d.RevoluteJoint revoluteJoint = _joint;
...@@ -161,7 +161,7 @@ class PhysicsJointRevolute extends PhysicsJoint { ...@@ -161,7 +161,7 @@ class PhysicsJointRevolute extends PhysicsJoint {
/// set to true and [maxMotorTorque] is set to a non zero value. /// set to true and [maxMotorTorque] is set to a non zero value.
double get motorSpeed => _motorSpeed; double get motorSpeed => _motorSpeed;
set motorSpeed(double motorSpeed) { void set motorSpeed(double motorSpeed) {
_motorSpeed = motorSpeed; _motorSpeed = motorSpeed;
if (_joint != null) { if (_joint != null) {
box2d.RevoluteJoint revoluteJoint = _joint; box2d.RevoluteJoint revoluteJoint = _joint;
...@@ -175,7 +175,7 @@ class PhysicsJointRevolute extends PhysicsJoint { ...@@ -175,7 +175,7 @@ class PhysicsJointRevolute extends PhysicsJoint {
/// Sets the motor torque of this joint, will only work if [enableMotor] is /// 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 to true and [motorSpeed] is set to a non zero value.
set maxMotorTorque(double maxMotorTorque) { void set maxMotorTorque(double maxMotorTorque) {
_maxMotorTorque = maxMotorTorque; _maxMotorTorque = maxMotorTorque;
if (_joint != null) { if (_joint != null) {
box2d.RevoluteJoint revoluteJoint = _joint; box2d.RevoluteJoint revoluteJoint = _joint;
...@@ -252,7 +252,7 @@ class PhysicsJointPrismatic extends PhysicsJoint { ...@@ -252,7 +252,7 @@ class PhysicsJointPrismatic extends PhysicsJoint {
/// [maxMotorForce]. /// [maxMotorForce].
bool get enableMotor => _enableMotor; bool get enableMotor => _enableMotor;
set enableMotor(bool enableMotor) { void set enableMotor(bool enableMotor) {
_enableMotor = enableMotor; _enableMotor = enableMotor;
if (_joint != null) { if (_joint != null) {
box2d.PrismaticJoint prismaticJoint = _joint; box2d.PrismaticJoint prismaticJoint = _joint;
...@@ -266,7 +266,7 @@ class PhysicsJointPrismatic extends PhysicsJoint { ...@@ -266,7 +266,7 @@ class PhysicsJointPrismatic extends PhysicsJoint {
/// set to true and [maxMotorForce] is set to a non zero value. /// set to true and [maxMotorForce] is set to a non zero value.
double get motorSpeed => _motorSpeed; double get motorSpeed => _motorSpeed;
set motorSpeed(double motorSpeed) { void set motorSpeed(double motorSpeed) {
_motorSpeed = motorSpeed; _motorSpeed = motorSpeed;
if (_joint != null) { if (_joint != null) {
box2d.PrismaticJoint prismaticJoint = _joint; box2d.PrismaticJoint prismaticJoint = _joint;
...@@ -280,7 +280,7 @@ class PhysicsJointPrismatic extends PhysicsJoint { ...@@ -280,7 +280,7 @@ class PhysicsJointPrismatic extends PhysicsJoint {
/// set to true and [motorSpeed] is set to a non zero value. /// set to true and [motorSpeed] is set to a non zero value.
double get maxMotorForce => _maxMotorForce; double get maxMotorForce => _maxMotorForce;
set maxMotorForce(double maxMotorForce) { void set maxMotorForce(double maxMotorForce) {
_maxMotorForce = maxMotorForce; _maxMotorForce = maxMotorForce;
if (_joint != null) { if (_joint != null) {
box2d.PrismaticJoint prismaticJoint = _joint; box2d.PrismaticJoint prismaticJoint = _joint;
......
...@@ -74,7 +74,7 @@ class PhysicsWorld extends Node { ...@@ -74,7 +74,7 @@ class PhysicsWorld extends Node {
return new Offset(g.x, g.y); 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 // Convert from points/s^2 to m/s^2
b2World.setGravity(new Vector2(gravity.dx / b2WorldToNodeConversionFactor, b2World.setGravity(new Vector2(gravity.dx / b2WorldToNodeConversionFactor,
gravity.dy / b2WorldToNodeConversionFactor)); gravity.dy / b2WorldToNodeConversionFactor));
...@@ -83,14 +83,14 @@ class PhysicsWorld extends Node { ...@@ -83,14 +83,14 @@ class PhysicsWorld extends Node {
/// If set to true, objects can fall asleep if the haven't moved in a while. /// If set to true, objects can fall asleep if the haven't moved in a while.
bool get allowSleep => b2World.isAllowSleep(); bool get allowSleep => b2World.isAllowSleep();
set allowSleep(bool allowSleep) { void set allowSleep(bool allowSleep) {
b2World.setAllowSleep(allowSleep); b2World.setAllowSleep(allowSleep);
} }
/// True if sub stepping should be used in the simulation. /// True if sub stepping should be used in the simulation.
bool get subStepping => b2World.isSubStepping(); bool get subStepping => b2World.isSubStepping();
set subStepping(bool subStepping) { void set subStepping(bool subStepping) {
b2World.setSubStepping(subStepping); b2World.setSubStepping(subStepping);
} }
......
...@@ -137,11 +137,8 @@ SoundTrackPlayer _sharedSoundTrackPlayer; ...@@ -137,11 +137,8 @@ SoundTrackPlayer _sharedSoundTrackPlayer;
class SoundTrackPlayer { class SoundTrackPlayer {
Set<SoundTrack> _soundTracks = new HashSet<SoundTrack>(); Set<SoundTrack> _soundTracks = new HashSet<SoundTrack>();
static sharedInstance() { static SoundTrackPlayer sharedInstance() {
if (_sharedSoundTrackPlayer == null) { return _sharedSoundTrackPlayer ??= new SoundTrackPlayer();
_sharedSoundTrackPlayer = new SoundTrackPlayer();
}
return _sharedSoundTrackPlayer;
} }
SoundTrackPlayer() { SoundTrackPlayer() {
......
...@@ -38,7 +38,8 @@ class SpriteBox extends RenderBox { ...@@ -38,7 +38,8 @@ class SpriteBox extends RenderBox {
|| value.size.height > 0); || value.size.height > 0);
// Remove sprite box references // Remove sprite box references
if (_rootNode != null) _removeSpriteBoxReference(_rootNode); if (_rootNode != null)
_removeSpriteBoxReference(_rootNode);
// Update the value // Update the value
_rootNode = value; _rootNode = value;
...@@ -374,7 +375,7 @@ class SpriteBox extends RenderBox { ...@@ -374,7 +375,7 @@ class SpriteBox extends RenderBox {
double delta = (timeStamp - _lastTimeStamp).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; double delta = (timeStamp - _lastTimeStamp).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND;
_lastTimeStamp = timeStamp; _lastTimeStamp = timeStamp;
_frameRate = 1.0/delta; _frameRate = 1.0 / delta;
if (_initialized) { if (_initialized) {
_callConstraintsPreUpdate(delta); _callConstraintsPreUpdate(delta);
...@@ -497,7 +498,7 @@ class SpriteBox extends RenderBox { ...@@ -497,7 +498,7 @@ class SpriteBox extends RenderBox {
return nodes; return nodes;
} }
_addNodesAtPosition(Node node, Point position, List<Node> list) { void _addNodesAtPosition(Node node, Point position, List<Node> list) {
// Visit children first // Visit children first
for (Node child in node.children) { for (Node child in node.children) {
_addNodesAtPosition(child, position, list); _addNodesAtPosition(child, position, list);
......
...@@ -21,7 +21,7 @@ class TexturedLinePainter { ...@@ -21,7 +21,7 @@ class TexturedLinePainter {
List<Point> get points => _points; List<Point> get points => _points;
set points(List<Point> points) { void set points(List<Point> points) {
_points = points; _points = points;
_calculatedTextureStops = null; _calculatedTextureStops = null;
} }
...@@ -32,7 +32,7 @@ class TexturedLinePainter { ...@@ -32,7 +32,7 @@ class TexturedLinePainter {
Texture get texture => _texture; Texture get texture => _texture;
set texture(Texture texture) { void set texture(Texture texture) {
_texture = texture; _texture = texture;
if (texture == null) { if (texture == null) {
_cachedPaint = new Paint(); _cachedPaint = new Paint();
...@@ -68,9 +68,9 @@ class TexturedLinePainter { ...@@ -68,9 +68,9 @@ class TexturedLinePainter {
double _textureLoopLength; double _textureLoopLength;
get textureLoopLength => textureLoopLength; double get textureLoopLength => textureLoopLength;
set textureLoopLength(double textureLoopLength) { void set textureLoopLength(double textureLoopLength) {
_textureLoopLength = textureLoopLength; _textureLoopLength = textureLoopLength;
_calculatedTextureStops = null; _calculatedTextureStops = null;
} }
......
...@@ -4,4 +4,6 @@ ...@@ -4,4 +4,6 @@
import 'package:flutter_tools/executable.dart' as executable; import 'package:flutter_tools/executable.dart' as executable;
main(List<String> args) => executable.main(args); void main(List<String> args) {
executable.main(args);
}
...@@ -204,7 +204,7 @@ class AdbDevice { ...@@ -204,7 +204,7 @@ class AdbDevice {
/// Device model; can be null. `XT1045`, `Nexus_7` /// Device model; can be null. `XT1045`, `Nexus_7`
String get modelID => _info['model']; String get modelID => _info['model'];
set modelID(String value) { void set modelID(String value) {
_info['model'] = value; _info['model'] = value;
} }
......
...@@ -288,6 +288,7 @@ analyzer: ...@@ -288,6 +288,7 @@ analyzer:
todo: ignore todo: ignore
linter: linter:
rules: rules:
- always_declare_return_types
# we'll turn on avoid_as as soon as it doesn't complain about "as dynamic" # we'll turn on avoid_as as soon as it doesn't complain about "as dynamic"
# - avoid_as # - avoid_as
- camel_case_types - camel_case_types
......
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
import 'package:flutter_tools/src/android/adb.dart'; import 'package:flutter_tools/src/android/adb.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
main() => defineTests(); void main() {
defineTests() {
Adb adb = new Adb('adb'); Adb adb = new Adb('adb');
// We only test the [Adb] class is we're able to locate the adb binary. // We only test the [Adb] class is we're able to locate the adb binary.
......
...@@ -14,9 +14,7 @@ import 'package:test/test.dart'; ...@@ -14,9 +14,7 @@ import 'package:test/test.dart';
import 'src/context.dart'; import 'src/context.dart';
main() => defineTests(); void main() {
defineTests() {
AnalysisServer server; AnalysisServer server;
Directory tempDir; Directory tempDir;
......
...@@ -7,9 +7,7 @@ import 'package:test/test.dart'; ...@@ -7,9 +7,7 @@ import 'package:test/test.dart';
import 'src/context.dart'; import 'src/context.dart';
main() => defineTests(); void main() {
defineTests() {
group('android_device', () { group('android_device', () {
testUsingContext('stores the requested id', () { testUsingContext('stores the requested id', () {
String deviceId = '1234'; String deviceId = '1234';
......
...@@ -7,9 +7,7 @@ import 'dart:async'; ...@@ -7,9 +7,7 @@ import 'dart:async';
import 'package:flutter_tools/src/base/utils.dart'; import 'package:flutter_tools/src/base/utils.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
main() => defineTests(); void main() {
defineTests() {
group('ItemListNotifier', () { group('ItemListNotifier', () {
test('sends notifications', () async { test('sends notifications', () async {
ItemListNotifier<String> list = new ItemListNotifier<String>(); ItemListNotifier<String> list = new ItemListNotifier<String>();
......
...@@ -7,9 +7,7 @@ import 'package:flutter_tools/src/base/logger.dart'; ...@@ -7,9 +7,7 @@ import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/globals.dart'; import 'package:flutter_tools/src/globals.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
main() => defineTests(); void main() {
defineTests() {
group('DeviceManager', () { group('DeviceManager', () {
test('error', () async { test('error', () async {
AppContext context = new AppContext(); AppContext context = new AppContext();
......
...@@ -13,9 +13,7 @@ import 'package:test/test.dart'; ...@@ -13,9 +13,7 @@ import 'package:test/test.dart';
import 'src/context.dart'; import 'src/context.dart';
main() => defineTests(); void main() {
defineTests() {
group('create', () { group('create', () {
Directory temp; Directory temp;
......
...@@ -17,9 +17,7 @@ import 'package:test/test.dart'; ...@@ -17,9 +17,7 @@ import 'package:test/test.dart';
import 'src/context.dart'; import 'src/context.dart';
import 'src/mocks.dart'; import 'src/mocks.dart';
main() => defineTests(); void main() {
defineTests() {
Daemon daemon; Daemon daemon;
AppContext appContext; AppContext appContext;
NotifyingLogger notifyingLogger; NotifyingLogger notifyingLogger;
......
...@@ -7,9 +7,7 @@ import 'package:test/test.dart'; ...@@ -7,9 +7,7 @@ import 'package:test/test.dart';
import 'src/context.dart'; import 'src/context.dart';
main() => defineTests(); void main() {
defineTests() {
group('DeviceManager', () { group('DeviceManager', () {
testUsingContext('getDevices', () async { testUsingContext('getDevices', () async {
// Test that DeviceManager.getDevices() doesn't throw. // Test that DeviceManager.getDevices() doesn't throw.
......
...@@ -10,9 +10,7 @@ import 'package:test/test.dart'; ...@@ -10,9 +10,7 @@ import 'package:test/test.dart';
import 'src/common.dart'; import 'src/common.dart';
import 'src/context.dart'; import 'src/context.dart';
main() => defineTests(); void main() {
defineTests() {
group('devices', () { group('devices', () {
testUsingContext('returns 0 when called', () { testUsingContext('returns 0 when called', () {
DevicesCommand command = new DevicesCommand(); DevicesCommand command = new DevicesCommand();
......
...@@ -20,9 +20,7 @@ import 'src/common.dart'; ...@@ -20,9 +20,7 @@ import 'src/common.dart';
import 'src/context.dart'; import 'src/context.dart';
import 'src/mocks.dart'; import 'src/mocks.dart';
main() => defineTests(); void main() {
defineTests() {
group('drive', () { group('drive', () {
DriveCommand command; DriveCommand command;
Device mockDevice; Device mockDevice;
...@@ -182,7 +180,7 @@ defineTests() { ...@@ -182,7 +180,7 @@ defineTests() {
}); });
group('findTargetDevice on iOS', () { group('findTargetDevice on iOS', () {
setOs() { void setOs() {
when(os.isMacOS).thenReturn(true); when(os.isMacOS).thenReturn(true);
when(os.isLinux).thenReturn(false); when(os.isLinux).thenReturn(false);
} }
...@@ -222,7 +220,7 @@ defineTests() { ...@@ -222,7 +220,7 @@ defineTests() {
}); });
group('findTargetDevice on Linux', () { group('findTargetDevice on Linux', () {
setOs() { void setOs() {
when(os.isMacOS).thenReturn(false); when(os.isMacOS).thenReturn(false);
when(os.isLinux).thenReturn(true); when(os.isLinux).thenReturn(true);
} }
......
...@@ -10,9 +10,7 @@ import 'src/common.dart'; ...@@ -10,9 +10,7 @@ import 'src/common.dart';
import 'src/context.dart'; import 'src/context.dart';
import 'src/mocks.dart'; import 'src/mocks.dart';
main() => defineTests(); void main() {
defineTests() {
group('install', () { group('install', () {
testUsingContext('returns 0 when Android is connected and ready for an install', () { testUsingContext('returns 0 when Android is connected and ready for an install', () {
InstallCommand command = new InstallCommand(); InstallCommand command = new InstallCommand();
......
...@@ -9,9 +9,7 @@ import 'src/common.dart'; ...@@ -9,9 +9,7 @@ import 'src/common.dart';
import 'src/context.dart'; import 'src/context.dart';
import 'src/mocks.dart'; import 'src/mocks.dart';
main() => defineTests(); void main() {
defineTests() {
group('listen', () { group('listen', () {
testUsingContext('returns 1 when no device is connected', () { testUsingContext('returns 1 when no device is connected', () {
ListenCommand command = new ListenCommand(singleRun: true); ListenCommand command = new ListenCommand(singleRun: true);
......
...@@ -9,9 +9,7 @@ import 'src/common.dart'; ...@@ -9,9 +9,7 @@ import 'src/common.dart';
import 'src/context.dart'; import 'src/context.dart';
import 'src/mocks.dart'; import 'src/mocks.dart';
main() => defineTests(); void main() {
defineTests() {
group('logs', () { group('logs', () {
testUsingContext('fail with a bad device id', () { testUsingContext('fail with a bad device id', () {
LogsCommand command = new LogsCommand(); LogsCommand command = new LogsCommand();
......
...@@ -8,9 +8,7 @@ import 'package:flutter_tools/src/base/os.dart'; ...@@ -8,9 +8,7 @@ import 'package:flutter_tools/src/base/os.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'package:test/test.dart'; import 'package:test/test.dart';
main() => defineTests(); void main() {
defineTests() {
group('OperatingSystemUtils', () { group('OperatingSystemUtils', () {
Directory temp; Directory temp;
......
...@@ -9,9 +9,7 @@ import 'src/common.dart'; ...@@ -9,9 +9,7 @@ import 'src/common.dart';
import 'src/context.dart'; import 'src/context.dart';
import 'src/mocks.dart'; import 'src/mocks.dart';
main() => defineTests(); void main() {
defineTests() {
group('run', () { group('run', () {
testUsingContext('fails when target not found', () { testUsingContext('fails when target not found', () {
RunCommand command = new RunCommand(); RunCommand command = new RunCommand();
......
...@@ -9,9 +9,7 @@ import 'package:flutter_tools/src/service_protocol.dart'; ...@@ -9,9 +9,7 @@ import 'package:flutter_tools/src/service_protocol.dart';
import 'src/mocks.dart'; import 'src/mocks.dart';
main() => defineTests(); void main() {
defineTests() {
group('service_protocol', () { group('service_protocol', () {
test('Discovery Heartbeat', () async { test('Discovery Heartbeat', () async {
MockDeviceLogReader logReader = new MockDeviceLogReader(); MockDeviceLogReader logReader = new MockDeviceLogReader();
......
...@@ -12,9 +12,7 @@ import 'src/common.dart'; ...@@ -12,9 +12,7 @@ import 'src/common.dart';
import 'src/context.dart'; import 'src/context.dart';
import 'src/mocks.dart'; import 'src/mocks.dart';
main() => defineTests(); void main() {
defineTests() {
group('stop', () { group('stop', () {
testUsingContext('returns 0 when Android is connected and ready to be stopped', () { testUsingContext('returns 0 when Android is connected and ready to be stopped', () {
StopCommand command = new StopCommand(); StopCommand command = new StopCommand();
......
...@@ -9,9 +9,7 @@ import 'src/common.dart'; ...@@ -9,9 +9,7 @@ import 'src/common.dart';
import 'src/context.dart'; import 'src/context.dart';
import 'src/mocks.dart'; import 'src/mocks.dart';
main() => defineTests(); void main() {
defineTests() {
group('trace', () { group('trace', () {
testUsingContext('returns 1 when no Android device is connected', () { testUsingContext('returns 1 when no Android device is connected', () {
TraceCommand command = new TraceCommand(); TraceCommand command = new TraceCommand();
......
import 'dart:async';
import 'dart:convert' hide BASE64; import 'dart:convert' hide BASE64;
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
...@@ -7,7 +8,7 @@ import 'package:flx/bundle.dart'; ...@@ -7,7 +8,7 @@ import 'package:flx/bundle.dart';
import 'package:flx/signing.dart'; import 'package:flx/signing.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
main() async { Future main() async {
// The following constant was generated via the openssl shell commands: // The following constant was generated via the openssl shell commands:
// openssl ecparam -genkey -name prime256v1 -out privatekey.pem // openssl ecparam -genkey -name prime256v1 -out privatekey.pem
// openssl ec -in privatekey.pem -outform DER | base64 // openssl ec -in privatekey.pem -outform DER | base64
......
...@@ -8,7 +8,7 @@ import 'package:crypto/crypto.dart'; ...@@ -8,7 +8,7 @@ import 'package:crypto/crypto.dart';
import 'package:flx/signing.dart'; import 'package:flx/signing.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
main() async { Future main() async {
// The following constant was generated via the openssl shell commands: // The following constant was generated via the openssl shell commands:
// openssl ecparam -genkey -name prime256v1 -out privatekey.pem // openssl ecparam -genkey -name prime256v1 -out privatekey.pem
// openssl ec -in privatekey.pem -outform DER | base64 // openssl ec -in privatekey.pem -outform DER | base64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment