Unverified Commit 5de96bb7 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

unnecessary this in field initializers (#22522)

parent 4bd6ad73
......@@ -148,8 +148,8 @@ class _TaskRunner {
class TaskResult {
/// Constructs a successful result.
TaskResult.success(this.data, {this.benchmarkScoreKeys = const <String>[]})
: this.succeeded = true,
this.message = 'success' {
: succeeded = true,
message = 'success' {
const JsonEncoder prettyJson = JsonEncoder.withIndent(' ');
if (benchmarkScoreKeys != null) {
for (String key in benchmarkScoreKeys) {
......@@ -173,9 +173,9 @@ class TaskResult {
/// Constructs an unsuccessful result.
TaskResult.failure(this.message)
: this.succeeded = false,
this.data = null,
this.benchmarkScoreKeys = const <String>[];
: succeeded = false,
data = null,
benchmarkScoreKeys = const <String>[];
/// Whether the task succeeded.
final bool succeeded;
......
......@@ -446,7 +446,7 @@ class _Transform {
/// Constructs a new _Transform, default arguments create a no-op transform.
_Transform({Matrix3 transformMatrix, this.opacity = 1.0}) :
this.transformMatrix = transformMatrix ?? Matrix3.identity();
transformMatrix = transformMatrix ?? Matrix3.identity();
final Matrix3 transformMatrix;
final double opacity;
......
......@@ -172,7 +172,7 @@ class CupertinoDatePicker extends StatefulWidget {
this.maximumYear,
this.minuteInterval = 1,
this.use24hFormat = false,
}) : this.initialDateTime = initialDateTime ?? DateTime.now(),
}) : initialDateTime = initialDateTime ?? DateTime.now(),
assert(mode != null),
assert(onDateTimeChanged != null),
assert(initialDateTime != null),
......
......@@ -49,7 +49,7 @@ class RawMaterialButton extends StatefulWidget {
this.clipBehavior = Clip.none,
MaterialTapTargetSize materialTapTargetSize,
this.child,
}) : this.materialTapTargetSize = materialTapTargetSize ?? MaterialTapTargetSize.padded,
}) : materialTapTargetSize = materialTapTargetSize ?? MaterialTapTargetSize.padded,
assert(shape != null),
assert(elevation != null),
assert(highlightElevation != null),
......
......@@ -128,7 +128,7 @@ class ExpansionPanelList extends StatefulWidget {
}) : assert(children != null),
assert(animationDuration != null),
_allowOnlyOnePanelOpen = false,
this.initialOpenPanelValue = null,
initialOpenPanelValue = null,
super(key: key);
/// Creates a radio expansion panel list widget.
......
......@@ -27,7 +27,7 @@ class BottomNavigationBarItem {
@required this.title,
Widget activeIcon,
this.backgroundColor,
}) : this.activeIcon = activeIcon ?? icon,
}) : activeIcon = activeIcon ?? icon,
assert(icon != null),
assert(title != null);
......
......@@ -78,7 +78,7 @@ abstract class Route<T> {
///
/// If the [settings] are not provided, an empty [RouteSettings] object is
/// used instead.
Route({ RouteSettings settings }) : this.settings = settings ?? const RouteSettings();
Route({ RouteSettings settings }) : settings = settings ?? const RouteSettings();
/// The navigator that the route is in, if any.
NavigatorState get navigator => _navigator;
......
......@@ -191,8 +191,8 @@ class ByText extends SerializableFinder {
class ByValueKey extends SerializableFinder {
/// Creates a finder given the key value.
ByValueKey(this.keyValue)
: this.keyValueString = '$keyValue',
this.keyValueType = '${keyValue.runtimeType}' {
: keyValueString = '$keyValue',
keyValueType = '${keyValue.runtimeType}' {
if (!_supportedKeyValueTypes.contains(keyValue.runtimeType))
throw _createInvalidKeyValueTypeError('$keyValue.runtimeType');
}
......
......@@ -11,7 +11,7 @@ class SetFrameSync extends Command {
/// Deserializes this command from the value generated by [serialize].
SetFrameSync.deserialize(Map<String, String> params)
: this.enabled = params['enabled'].toLowerCase() == 'true',
: enabled = params['enabled'].toLowerCase() == 'true',
super.deserialize(params);
/// Whether frameSync should be enabled or disabled.
......
......@@ -44,10 +44,10 @@ class Scroll extends CommandWithTarget {
/// Deserializes this command from the value generated by [serialize].
Scroll.deserialize(Map<String, String> json)
: this.dx = double.parse(json['dx']),
this.dy = double.parse(json['dy']),
this.duration = Duration(microseconds: int.parse(json['duration'])),
this.frequency = int.parse(json['frequency']),
: dx = double.parse(json['dx']),
dy = double.parse(json['dy']),
duration = Duration(microseconds: int.parse(json['duration'])),
frequency = int.parse(json['frequency']),
super.deserialize(json);
/// Delta X offset per move event.
......@@ -94,7 +94,7 @@ class ScrollIntoView extends CommandWithTarget {
/// Deserializes this command from the value generated by [serialize].
ScrollIntoView.deserialize(Map<String, String> json)
: this.alignment = double.parse(json['alignment']),
: alignment = double.parse(json['alignment']),
super.deserialize(json);
/// How the widget should be aligned.
......
......@@ -10,7 +10,7 @@ abstract class Command {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const Command({ Duration timeout })
: this.timeout = timeout ?? const Duration(seconds: 5);
: timeout = timeout ?? const Duration(seconds: 5);
/// Deserializes this command from the value generated by [serialize].
Command.deserialize(Map<String, String> json)
......
......@@ -12,7 +12,7 @@ class RequestData extends Command {
/// Deserializes this command from the value generated by [serialize].
RequestData.deserialize(Map<String, String> params)
: this.message = params['message'],
: message = params['message'],
super.deserialize(params);
/// The message being sent from the test to the application.
......
......@@ -11,7 +11,7 @@ class SetSemantics extends Command {
/// Deserializes this command from the value generated by [serialize].
SetSemantics.deserialize(Map<String, String> params)
: this.enabled = params['enabled'].toLowerCase() == 'true',
: enabled = params['enabled'].toLowerCase() == 'true',
super.deserialize(params);
/// Whether semantics should be enabled (true) or disabled (false).
......
......@@ -207,7 +207,7 @@ class TimelineSummary {
class TimedEvent {
/// Creates a timed event given begin and end timestamps in microseconds.
TimedEvent(int beginTimeMicros, int endTimeMicros)
: this.duration = Duration(microseconds: endTimeMicros - beginTimeMicros);
: duration = Duration(microseconds: endTimeMicros - beginTimeMicros);
/// The duration of the event.
final Duration duration;
......
......@@ -100,19 +100,19 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations {
@required intl.NumberFormat decimalFormat,
@required intl.NumberFormat twoDigitZeroPaddedFormat,
}) : assert(localeName != null),
this._localeName = localeName,
_localeName = localeName,
assert(fullYearFormat != null),
this._fullYearFormat = fullYearFormat,
_fullYearFormat = fullYearFormat,
assert(mediumDateFormat != null),
this._mediumDateFormat = mediumDateFormat,
_mediumDateFormat = mediumDateFormat,
assert(longDateFormat != null),
this._longDateFormat = longDateFormat,
_longDateFormat = longDateFormat,
assert(yearMonthFormat != null),
this._yearMonthFormat = yearMonthFormat,
_yearMonthFormat = yearMonthFormat,
assert(decimalFormat != null),
this._decimalFormat = decimalFormat,
_decimalFormat = decimalFormat,
assert(twoDigitZeroPaddedFormat != null),
this._twoDigitZeroPaddedFormat = twoDigitZeroPaddedFormat;
_twoDigitZeroPaddedFormat = twoDigitZeroPaddedFormat;
final String _localeName;
final intl.DateFormat _fullYearFormat;
......
......@@ -32,7 +32,7 @@ String get javaPath => androidStudio?.javaPath;
class AndroidStudio implements Comparable<AndroidStudio> {
AndroidStudio(this.directory,
{Version version, this.configured, this.studioAppName = 'AndroidStudio'})
: this.version = version ?? Version.unknown {
: version = version ?? Version.unknown {
_init();
}
......
......@@ -35,7 +35,7 @@ class FlutterDevice {
this.fileSystemRoots,
this.fileSystemScheme,
ResidentCompiler generator,
}) : this.generator = generator ?? ResidentCompiler(
}) : generator = generator ?? ResidentCompiler(
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
trackWidgetCreation: trackWidgetCreation,
fileSystemRoots: fileSystemRoots, fileSystemScheme: fileSystemScheme
......
......@@ -9,7 +9,7 @@ import 'watcher.dart';
/// Prints JSON events when running a test in --machine mode.
class EventPrinter extends TestWatcher {
EventPrinter({StringSink out}) : this._out = out == null ? stdout: out;
EventPrinter({StringSink out}) : _out = out == null ? stdout: out;
final StringSink _out;
......
......@@ -14,7 +14,7 @@ const bool _includeInsiders = false;
class VsCode {
VsCode._(this.directory, this.extensionDirectory, { Version version, this.edition })
: this.version = version ?? Version.unknown {
: version = version ?? Version.unknown {
if (!fs.isDirectorySync(directory)) {
_validationMessages.add('VS Code not found at $directory');
......@@ -195,7 +195,7 @@ class VsCode {
class _VsCodeInstallLocation {
const _VsCodeInstallLocation(this.installPath, this.extensionsFolder, { this.edition, bool isInsiders })
: this.isInsiders = isInsiders ?? false;
: isInsiders = isInsiders ?? false;
final String installPath;
final String extensionsFolder;
final String edition;
......
......@@ -24,7 +24,7 @@ const Duration quitTimeout = Duration(seconds: 10);
class FlutterTestDriver {
FlutterTestDriver(this._projectFolder, {String logPrefix}):
this._logPrefix = logPrefix != null ? '$logPrefix: ' : '';
_logPrefix = logPrefix != null ? '$logPrefix: ' : '';
final Directory _projectFolder;
final String _logPrefix;
......
......@@ -69,9 +69,9 @@ class LogMessage {
///
/// When this message is created, it sets its [time] to [DateTime.now].
LogMessage(this.message, this.tag, this.level)
: this.levelName =
: levelName =
level.toString().substring(level.toString().indexOf('.') + 1),
this.time = DateTime.now();
time = DateTime.now();
/// The actual log message.
final String message;
......
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