sort_constructors_first (#22575)
diff --git a/dev/devicelab/bin/tasks/gradle_plugin_test.dart b/dev/devicelab/bin/tasks/gradle_plugin_test.dart
index 8521314..a2b2545 100644
--- a/dev/devicelab/bin/tasks/gradle_plugin_test.dart
+++ b/dev/devicelab/bin/tasks/gradle_plugin_test.dart
@@ -281,8 +281,6 @@
}
class _Dependencies {
- String target;
- Set<String> dependencies;
_Dependencies(String depfilePath) {
final RegExp _separatorExpr = RegExp(r'([^\\]) ');
final RegExp _escapeExpr = RegExp(r'\\(.)');
@@ -301,6 +299,9 @@
.where((String path) => path.isNotEmpty)
.toSet();
}
+
+ String target;
+ Set<String> dependencies;
}
/// Returns [null] if target matches [expectedTarget], otherwise returns an error message.
diff --git a/dev/devicelab/lib/framework/adb.dart b/dev/devicelab/lib/framework/adb.dart
index 2ea21c8..bcee6a4 100644
--- a/dev/devicelab/lib/framework/adb.dart
+++ b/dev/devicelab/lib/framework/adb.dart
@@ -100,6 +100,12 @@
}
class AndroidDeviceDiscovery implements DeviceDiscovery {
+ factory AndroidDeviceDiscovery() {
+ return _instance ??= AndroidDeviceDiscovery._();
+ }
+
+ AndroidDeviceDiscovery._();
+
// Parses information about a device. Example:
//
// 015d172c98400a03 device usb:340787200X product:nakasi model:Nexus_7 device:grouper
@@ -107,12 +113,6 @@
static AndroidDeviceDiscovery _instance;
- factory AndroidDeviceDiscovery() {
- return _instance ??= AndroidDeviceDiscovery._();
- }
-
- AndroidDeviceDiscovery._();
-
AndroidDevice _workingDevice;
@override
@@ -349,15 +349,14 @@
}
class IosDeviceDiscovery implements DeviceDiscovery {
-
- static IosDeviceDiscovery _instance;
-
factory IosDeviceDiscovery() {
return _instance ??= IosDeviceDiscovery._();
}
IosDeviceDiscovery._();
+ static IosDeviceDiscovery _instance;
+
IosDevice _workingDevice;
@override
diff --git a/dev/devicelab/lib/framework/framework.dart b/dev/devicelab/lib/framework/framework.dart
index 7bc0b64..b3063a5 100644
--- a/dev/devicelab/lib/framework/framework.dart
+++ b/dev/devicelab/lib/framework/framework.dart
@@ -49,17 +49,6 @@
}
class _TaskRunner {
- static final Logger logger = Logger('TaskRunner');
-
- final TaskFunction task;
-
- // TODO(ianh): workaround for https://github.com/dart-lang/sdk/issues/23797
- RawReceivePort _keepAlivePort;
- Timer _startTaskTimeout;
- bool _taskStarted = false;
-
- final Completer<TaskResult> _completer = Completer<TaskResult>();
-
_TaskRunner(this.task) {
registerExtension('ext.cocoonRunTask',
(String method, Map<String, String> parameters) async {
@@ -75,6 +64,17 @@
});
}
+ final TaskFunction task;
+
+ // TODO(ianh): workaround for https://github.com/dart-lang/sdk/issues/23797
+ RawReceivePort _keepAlivePort;
+ Timer _startTaskTimeout;
+ bool _taskStarted = false;
+
+ final Completer<TaskResult> _completer = Completer<TaskResult>();
+
+ static final Logger logger = Logger('TaskRunner');
+
/// Signals that this task runner finished running the task.
Future<TaskResult> get whenDone => _completer.future;
diff --git a/dev/devicelab/lib/tasks/plugin_tests.dart b/dev/devicelab/lib/tasks/plugin_tests.dart
index e0bd265..3a70f73 100644
--- a/dev/devicelab/lib/tasks/plugin_tests.dart
+++ b/dev/devicelab/lib/tasks/plugin_tests.dart
@@ -26,11 +26,11 @@
/// Defines task that creates new Flutter project, adds a plugin, and then
/// builds the specified [buildTarget].
class PluginTest {
+ PluginTest(this.buildTarget, this.options);
+
final String buildTarget;
final List<String> options;
- PluginTest(this.buildTarget, this.options);
-
Future<TaskResult> call() async {
section('Create Flutter project');
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_devicelab_plugin_test.');
diff --git a/dev/integration_tests/channels/lib/src/pair.dart b/dev/integration_tests/channels/lib/src/pair.dart
index 907d104..52dc3f2 100644
--- a/dev/integration_tests/channels/lib/src/pair.dart
+++ b/dev/integration_tests/channels/lib/src/pair.dart
@@ -4,11 +4,11 @@
/// A pair of values. Used for testing custom codecs.
class Pair {
+ Pair(this.left, this.right);
+
final dynamic left;
final dynamic right;
- Pair(this.left, this.right);
-
@override
String toString() => 'Pair[$left, $right]';
}
diff --git a/dev/integration_tests/channels/lib/src/test_step.dart b/dev/integration_tests/channels/lib/src/test_step.dart
index 39caab2..3806ecf 100644
--- a/dev/integration_tests/channels/lib/src/test_step.dart
+++ b/dev/integration_tests/channels/lib/src/test_step.dart
@@ -25,13 +25,6 @@
/// - The Flutter app records the incoming reply echo.
/// - The platform finally replies to the original message with another echo.
class TestStepResult {
- static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
- static const TestStepResult complete = TestStepResult(
- 'Test complete',
- nothing,
- TestStatus.complete,
- );
-
const TestStepResult(
this.name,
this.description,
@@ -71,6 +64,13 @@
final dynamic replyEcho;
final dynamic error;
+ static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
+ static const TestStepResult complete = TestStepResult(
+ 'Test complete',
+ nothing,
+ TestStatus.complete,
+ );
+
Widget asWidget(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
diff --git a/dev/integration_tests/platform_interaction/lib/src/test_step.dart b/dev/integration_tests/platform_interaction/lib/src/test_step.dart
index 1da4766..48077d2 100644
--- a/dev/integration_tests/platform_interaction/lib/src/test_step.dart
+++ b/dev/integration_tests/platform_interaction/lib/src/test_step.dart
@@ -13,13 +13,6 @@
const String nothing = '-';
class TestStepResult {
- static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
- static const TestStepResult complete = TestStepResult(
- 'Test complete',
- nothing,
- TestStatus.complete,
- );
-
const TestStepResult(this.name, this.description, this.status);
factory TestStepResult.fromSnapshot(AsyncSnapshot<TestStepResult> snapshot) {
@@ -45,6 +38,13 @@
final String description;
final TestStatus status;
+ static const TextStyle bold = TextStyle(fontWeight: FontWeight.bold);
+ static const TestStepResult complete = TestStepResult(
+ 'Test complete',
+ nothing,
+ TestStatus.complete,
+ );
+
Widget asWidget(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
diff --git a/examples/flutter_gallery/lib/demo/animation/widgets.dart b/examples/flutter_gallery/lib/demo/animation/widgets.dart
index 6c82ec2..60583d3e 100644
--- a/examples/flutter_gallery/lib/demo/animation/widgets.dart
+++ b/examples/flutter_gallery/lib/demo/animation/widgets.dart
@@ -47,19 +47,6 @@
// The title is rendered with two overlapping text widgets that are vertically
// offset a little. It's supposed to look sort-of 3D.
class SectionTitle extends StatelessWidget {
- static const TextStyle sectionTitleStyle = TextStyle(
- fontFamily: 'Raleway',
- inherit: false,
- fontSize: 24.0,
- fontWeight: FontWeight.w500,
- color: Colors.white,
- textBaseline: TextBaseline.alphabetic,
- );
-
- static final TextStyle sectionTitleShadowStyle = sectionTitleStyle.copyWith(
- color: const Color(0x19000000),
- );
-
const SectionTitle({
Key key,
@required this.section,
@@ -74,6 +61,19 @@
final double scale;
final double opacity;
+ static const TextStyle sectionTitleStyle = TextStyle(
+ fontFamily: 'Raleway',
+ inherit: false,
+ fontSize: 24.0,
+ fontWeight: FontWeight.w500,
+ color: Colors.white,
+ textBaseline: TextBaseline.alphabetic,
+ );
+
+ static final TextStyle sectionTitleShadowStyle = sectionTitleStyle.copyWith(
+ color: const Color(0x19000000),
+ );
+
@override
Widget build(BuildContext context) {
return IgnorePointer(
diff --git a/examples/flutter_gallery/lib/demo/colors_demo.dart b/examples/flutter_gallery/lib/demo/colors_demo.dart
index 59a9427..9ac109e 100644
--- a/examples/flutter_gallery/lib/demo/colors_demo.dart
+++ b/examples/flutter_gallery/lib/demo/colors_demo.dart
@@ -83,9 +83,6 @@
}
class PaletteTabView extends StatelessWidget {
- static const List<int> primaryKeys = <int>[50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
- static const List<int> accentKeys = <int>[100, 200, 400, 700];
-
PaletteTabView({
Key key,
@required this.colors,
@@ -94,6 +91,9 @@
final Palette colors;
+ static const List<int> primaryKeys = <int>[50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
+ static const List<int> accentKeys = <int>[100, 200, 400, 700];
+
@override
Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme;
diff --git a/examples/flutter_gallery/lib/demo/pesto_demo.dart b/examples/flutter_gallery/lib/demo/pesto_demo.dart
index 8683c33..d738d8b 100644
--- a/examples/flutter_gallery/lib/demo/pesto_demo.dart
+++ b/examples/flutter_gallery/lib/demo/pesto_demo.dart
@@ -432,14 +432,14 @@
/// Displays the recipe's name and instructions.
class RecipeSheet extends StatelessWidget {
+ RecipeSheet({ Key key, this.recipe }) : super(key: key);
+
final TextStyle titleStyle = const PestoStyle(fontSize: 34.0);
final TextStyle descriptionStyle = const PestoStyle(fontSize: 15.0, color: Colors.black54, height: 24.0/15.0);
final TextStyle itemStyle = const PestoStyle(fontSize: 15.0, height: 24.0/15.0);
final TextStyle itemAmountStyle = PestoStyle(fontSize: 15.0, color: _kTheme.primaryColor, height: 24.0/15.0);
final TextStyle headingStyle = const PestoStyle(fontSize: 16.0, fontWeight: FontWeight.bold, height: 24.0/15.0);
- RecipeSheet({ Key key, this.recipe }) : super(key: key);
-
final Recipe recipe;
@override
diff --git a/examples/flutter_gallery/lib/demo/video_demo.dart b/examples/flutter_gallery/lib/demo/video_demo.dart
index 59bbc1c..a100591 100644
--- a/examples/flutter_gallery/lib/demo/video_demo.dart
+++ b/examples/flutter_gallery/lib/demo/video_demo.dart
@@ -14,13 +14,13 @@
'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4';
class VideoCard extends StatelessWidget {
+ const VideoCard({Key key, this.controller, this.title, this.subtitle})
+ : super(key: key);
+
final VideoPlayerController controller;
final String title;
final String subtitle;
- const VideoCard({Key key, this.controller, this.title, this.subtitle})
- : super(key: key);
-
Widget _buildInlineVideo() {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 30.0),
@@ -93,10 +93,10 @@
}
class VideoPlayerLoading extends StatefulWidget {
- final VideoPlayerController controller;
-
const VideoPlayerLoading(this.controller);
+ final VideoPlayerController controller;
+
@override
_VideoPlayerLoadingState createState() => _VideoPlayerLoadingState();
}
@@ -137,18 +137,15 @@
}
class VideoPlayPause extends StatefulWidget {
- final VideoPlayerController controller;
-
const VideoPlayPause(this.controller);
+ final VideoPlayerController controller;
+
@override
State createState() => _VideoPlayPauseState();
}
class _VideoPlayPauseState extends State<VideoPlayPause> {
- FadeAnimation imageFadeAnimation;
- VoidCallback listener;
-
_VideoPlayPauseState() {
listener = () {
if (mounted)
@@ -156,6 +153,9 @@
};
}
+ FadeAnimation imageFadeAnimation;
+ VoidCallback listener;
+
VideoPlayerController get controller => widget.controller;
@override
@@ -202,14 +202,14 @@
}
class FadeAnimation extends StatefulWidget {
- final Widget child;
- final Duration duration;
-
const FadeAnimation({
this.child,
this.duration = const Duration(milliseconds: 500),
});
+ final Widget child;
+ final Duration duration;
+
@override
_FadeAnimationState createState() => _FadeAnimationState();
}
@@ -265,16 +265,16 @@
}
class ConnectivityOverlay extends StatefulWidget {
- final Widget child;
- final Completer<Null> connectedCompleter;
- final GlobalKey<ScaffoldState> scaffoldKey;
-
const ConnectivityOverlay({
this.child,
this.connectedCompleter,
this.scaffoldKey,
});
+ final Widget child;
+ final Completer<Null> connectedCompleter;
+ final GlobalKey<ScaffoldState> scaffoldKey;
+
@override
_ConnectivityOverlayState createState() => _ConnectivityOverlayState();
}
diff --git a/examples/flutter_gallery/lib/gallery/home.dart b/examples/flutter_gallery/lib/gallery/home.dart
index 8d156f2..13bc8bb 100644
--- a/examples/flutter_gallery/lib/gallery/home.dart
+++ b/examples/flutter_gallery/lib/gallery/home.dart
@@ -268,10 +268,6 @@
}
class GalleryHome extends StatefulWidget {
- // In checked mode our MaterialApp will show the default "debug" banner.
- // Otherwise show the "preview" banner.
- static bool showPreviewBanner = true;
-
const GalleryHome({
Key key,
this.testMode = false,
@@ -281,6 +277,10 @@
final Widget optionsPage;
final bool testMode;
+ // In checked mode our MaterialApp will show the default "debug" banner.
+ // Otherwise show the "preview" banner.
+ static bool showPreviewBanner = true;
+
@override
_GalleryHomeState createState() => _GalleryHomeState();
}
diff --git a/examples/layers/rendering/src/solid_color_box.dart b/examples/layers/rendering/src/solid_color_box.dart
index 419d181..9e4660d 100644
--- a/examples/layers/rendering/src/solid_color_box.dart
+++ b/examples/layers/rendering/src/solid_color_box.dart
@@ -6,12 +6,12 @@
import 'package:flutter/gestures.dart';
class RenderSolidColorBox extends RenderDecoratedBox {
- final Size desiredSize;
- final Color backgroundColor;
-
RenderSolidColorBox(this.backgroundColor, { this.desiredSize = Size.infinite })
: super(decoration: BoxDecoration(color: backgroundColor));
+ final Size desiredSize;
+ final Color backgroundColor;
+
@override
double computeMinIntrinsicWidth(double height) {
return desiredSize.width == double.infinity ? 0.0 : desiredSize.width;
diff --git a/examples/stocks/lib/stock_data.dart b/examples/stocks/lib/stock_data.dart
index be28ad1..e8d98db 100644
--- a/examples/stocks/lib/stock_data.dart
+++ b/examples/stocks/lib/stock_data.dart
@@ -16,12 +16,6 @@
final math.Random _rng = math.Random();
class Stock {
- String symbol;
- String name;
- double lastSale;
- String marketCap;
- double percentChange;
-
Stock(this.symbol, this.name, this.lastSale, this.marketCap, this.percentChange);
Stock.fromFields(List<String> fields) {
@@ -36,6 +30,12 @@
marketCap = fields[4];
percentChange = (_rng.nextDouble() * 20) - 10;
}
+
+ String symbol;
+ String name;
+ double lastSale;
+ String marketCap;
+ double percentChange;
}
class StockData extends ChangeNotifier {
diff --git a/packages/flutter/lib/src/foundation/basic_types.dart b/packages/flutter/lib/src/foundation/basic_types.dart
index dcc4fae..f4dfe93 100644
--- a/packages/flutter/lib/src/foundation/basic_types.dart
+++ b/packages/flutter/lib/src/foundation/basic_types.dart
@@ -77,10 +77,6 @@
/// A BitField over an enum (or other class whose values implement "index").
/// Only the first 62 values of the enum can be used as indices.
class BitField<T extends dynamic> {
- static const int _smiBits = 62; // see https://www.dartlang.org/articles/numeric-computation/#smis-and-mints
- static const int _allZeros = 0;
- static const int _allOnes = kMaxUnsignedSMI; // 2^(_kSMIBits+1)-1
-
/// Creates a bit field of all zeros.
///
/// The given length must be at most 62.
@@ -101,6 +97,10 @@
final int _length;
int _bits;
+ static const int _smiBits = 62; // see https://www.dartlang.org/articles/numeric-computation/#smis-and-mints
+ static const int _allZeros = 0;
+ static const int _allOnes = kMaxUnsignedSMI; // 2^(_kSMIBits+1)-1
+
/// Returns whether the bit with the given index is set to one.
bool operator [](T index) {
assert(index.index < _length);
diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart
index 602b9bd..53b172c 100644
--- a/packages/flutter/lib/src/material/date_picker.dart
+++ b/packages/flutter/lib/src/material/date_picker.dart
@@ -720,11 +720,11 @@
// Defines semantic traversal order of the top-level widgets inside the month
// picker.
class _MonthPickerSortKey extends OrdinalSortKey {
+ const _MonthPickerSortKey(double order) : super(order);
+
static const _MonthPickerSortKey previousMonth = _MonthPickerSortKey(1.0);
static const _MonthPickerSortKey nextMonth = _MonthPickerSortKey(2.0);
static const _MonthPickerSortKey calendar = _MonthPickerSortKey(3.0);
-
- const _MonthPickerSortKey(double order) : super(order);
}
/// A scrollable list of years to allow picking a year.
diff --git a/packages/flutter/lib/src/material/ink_ripple.dart b/packages/flutter/lib/src/material/ink_ripple.dart
index b42f90e..457eaf4 100644
--- a/packages/flutter/lib/src/material/ink_ripple.dart
+++ b/packages/flutter/lib/src/material/ink_ripple.dart
@@ -92,13 +92,6 @@
/// * [InkHighlight], which is an ink feature that emphasizes a part of a
/// [Material].
class InkRipple extends InteractiveInkFeature {
- /// Used to specify this type of ink splash for an [InkWell], [InkResponse]
- /// or material [Theme].
- static const InteractiveInkFeatureFactory splashFactory = _InkRippleFactory();
-
- static final Animatable<double> _easeCurveTween = CurveTween(curve: Curves.ease);
- static final Animatable<double> _fadeOutIntervalTween = CurveTween(curve: const Interval(_kFadeOutIntervalStart, 1.0));
-
/// Begin a ripple, centered at [position] relative to [referenceBox].
///
/// The [controller] argument is typically obtained via
@@ -192,6 +185,13 @@
Animation<int> _fadeOut;
AnimationController _fadeOutController;
+ /// Used to specify this type of ink splash for an [InkWell], [InkResponse]
+ /// or material [Theme].
+ static const InteractiveInkFeatureFactory splashFactory = _InkRippleFactory();
+
+ static final Animatable<double> _easeCurveTween = CurveTween(curve: Curves.ease);
+ static final Animatable<double> _fadeOutIntervalTween = CurveTween(curve: const Interval(_kFadeOutIntervalStart, 1.0));
+
@override
void confirm() {
_radiusController
diff --git a/packages/flutter/lib/src/material/ink_splash.dart b/packages/flutter/lib/src/material/ink_splash.dart
index 96482f8..c65a386 100644
--- a/packages/flutter/lib/src/material/ink_splash.dart
+++ b/packages/flutter/lib/src/material/ink_splash.dart
@@ -96,10 +96,6 @@
/// * [InkHighlight], which is an ink feature that emphasizes a part of a
/// [Material].
class InkSplash extends InteractiveInkFeature {
- /// Used to specify this type of ink splash for an [InkWell], [InkResponse]
- /// or material [Theme].
- static const InteractiveInkFeatureFactory splashFactory = _InkSplashFactory();
-
/// Begin a splash, centered at position relative to [referenceBox].
///
/// The [controller] argument is typically obtained via
@@ -169,6 +165,10 @@
Animation<int> _alpha;
AnimationController _alphaController;
+ /// Used to specify this type of ink splash for an [InkWell], [InkResponse]
+ /// or material [Theme].
+ static const InteractiveInkFeatureFactory splashFactory = _InkSplashFactory();
+
@override
void confirm() {
final int duration = (_targetRadius / _kSplashConfirmedVelocity).floor();
diff --git a/packages/flutter/lib/src/material/input_border.dart b/packages/flutter/lib/src/material/input_border.dart
index 33d828b..6709d16 100644
--- a/packages/flutter/lib/src/material/input_border.dart
+++ b/packages/flutter/lib/src/material/input_border.dart
@@ -28,13 +28,6 @@
/// rounded rectangle around the input decorator's container.
/// * [InputDecoration], which is used to configure an [InputDecorator].
abstract class InputBorder extends ShapeBorder {
- /// No input border.
- ///
- /// Use this value with [InputDecoration.border] to specify that no border
- /// should be drawn. The [InputDecoration.shrinkWrap] constructor sets
- /// its border to this value.
- static const InputBorder none = _NoInputBorder();
-
/// Creates a border for an [InputDecorator].
///
/// The [borderSide] parameter must not be null. Applications typically do
@@ -45,6 +38,13 @@
this.borderSide = BorderSide.none,
}) : assert(borderSide != null);
+ /// No input border.
+ ///
+ /// Use this value with [InputDecoration.border] to specify that no border
+ /// should be drawn. The [InputDecoration.shrinkWrap] constructor sets
+ /// its border to this value.
+ static const InputBorder none = _NoInputBorder();
+
/// Defines the border line's color and weight.
///
/// The [InputDecorator] creates copies of its input border, using [copyWith],
diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart
index 4c0480c..86bea89 100644
--- a/packages/flutter/lib/src/material/progress_indicator.dart
+++ b/packages/flutter/lib/src/material/progress_indicator.dart
@@ -69,6 +69,20 @@
}
class _LinearProgressIndicatorPainter extends CustomPainter {
+ const _LinearProgressIndicatorPainter({
+ this.backgroundColor,
+ this.valueColor,
+ this.value,
+ this.animationValue,
+ @required this.textDirection,
+ }) : assert(textDirection != null);
+
+ final Color backgroundColor;
+ final Color valueColor;
+ final double value;
+ final double animationValue;
+ final TextDirection textDirection;
+
// The indeterminate progress animation displays two lines whose leading (head)
// and trailing (tail) endpoints are defined by the following four curves.
static const Curve line1Head = Interval(
@@ -92,20 +106,6 @@
curve: Cubic(0.10, 0.0, 0.45, 1.0),
);
- const _LinearProgressIndicatorPainter({
- this.backgroundColor,
- this.valueColor,
- this.value,
- this.animationValue,
- @required this.textDirection,
- }) : assert(textDirection != null);
-
- final Color backgroundColor;
- final Color valueColor;
- final double value;
- final double animationValue;
- final TextDirection textDirection;
-
@override
void paint(Canvas canvas, Size size) {
final Paint paint = Paint()
@@ -254,12 +254,6 @@
}
class _CircularProgressIndicatorPainter extends CustomPainter {
- static const double _twoPi = math.pi * 2.0;
- static const double _epsilon = .001;
- // Canvas.drawArc(r, 0, 2*PI) doesn't draw anything, so just get close.
- static const double _sweep = _twoPi - _epsilon;
- static const double _startAngle = -math.pi / 2.0;
-
_CircularProgressIndicatorPainter({
this.valueColor,
this.value,
@@ -285,6 +279,12 @@
final double arcStart;
final double arcSweep;
+ static const double _twoPi = math.pi * 2.0;
+ static const double _epsilon = .001;
+ // Canvas.drawArc(r, 0, 2*PI) doesn't draw anything, so just get close.
+ static const double _sweep = _twoPi - _epsilon;
+ static const double _startAngle = -math.pi / 2.0;
+
@override
void paint(Canvas canvas, Size size) {
final Paint paint = Paint()
diff --git a/packages/flutter/lib/src/material/time.dart b/packages/flutter/lib/src/material/time.dart
index 11216a5..2dbf8f8 100644
--- a/packages/flutter/lib/src/material/time.dart
+++ b/packages/flutter/lib/src/material/time.dart
@@ -30,15 +30,6 @@
/// time zones.
@immutable
class TimeOfDay {
- /// The number of hours in one day, i.e. 24.
- static const int hoursPerDay = 24;
-
- /// The number of hours in one day period (see also [DayPeriod]), i.e. 12.
- static const int hoursPerPeriod = 12;
-
- /// The number of minutes in one hour, i.e. 60.
- static const int minutesPerHour = 60;
-
/// Creates a time of day.
///
/// The [hour] argument must be between 0 and 23, inclusive. The [minute]
@@ -57,6 +48,15 @@
/// current minute in the local time zone.
factory TimeOfDay.now() { return TimeOfDay.fromDateTime(DateTime.now()); }
+ /// The number of hours in one day, i.e. 24.
+ static const int hoursPerDay = 24;
+
+ /// The number of hours in one day period (see also [DayPeriod]), i.e. 12.
+ static const int hoursPerPeriod = 12;
+
+ /// The number of minutes in one hour, i.e. 60.
+ static const int minutesPerHour = 60;
+
/// Returns a new TimeOfDay with the hour and/or minute replaced.
TimeOfDay replacing({ int hour, int minute }) {
assert(hour == null || (hour >= 0 && hour < hoursPerDay));
diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart
index a3dac1a..c6d699d 100644
--- a/packages/flutter/lib/src/rendering/box.dart
+++ b/packages/flutter/lib/src/rendering/box.dart
@@ -92,22 +92,6 @@
this.maxHeight = double.infinity
});
- /// The minimum width that satisfies the constraints.
- final double minWidth;
-
- /// The maximum width that satisfies the constraints.
- ///
- /// Might be [double.infinity].
- final double maxWidth;
-
- /// The minimum height that satisfies the constraints.
- final double minHeight;
-
- /// The maximum height that satisfies the constraints.
- ///
- /// Might be [double.infinity].
- final double maxHeight;
-
/// Creates box constraints that is respected only by the given size.
BoxConstraints.tight(Size size)
: minWidth = size.width,
@@ -164,6 +148,22 @@
minHeight = height != null ? height : double.infinity,
maxHeight = height != null ? height : double.infinity;
+ /// The minimum width that satisfies the constraints.
+ final double minWidth;
+
+ /// The maximum width that satisfies the constraints.
+ ///
+ /// Might be [double.infinity].
+ final double maxWidth;
+
+ /// The minimum height that satisfies the constraints.
+ final double minHeight;
+
+ /// The maximum height that satisfies the constraints.
+ ///
+ /// Might be [double.infinity].
+ final double maxHeight;
+
/// Creates a copy of this box constraints but with the given fields replaced with the new values.
BoxConstraints copyWith({
double minWidth,
diff --git a/packages/flutter/lib/src/services/message_codecs.dart b/packages/flutter/lib/src/services/message_codecs.dart
index 88ed29e..1492c2c 100644
--- a/packages/flutter/lib/src/services/message_codecs.dart
+++ b/packages/flutter/lib/src/services/message_codecs.dart
@@ -212,6 +212,9 @@
/// The codec is extensible by subclasses overriding [writeValue] and
/// [readValueOfType].
class StandardMessageCodec implements MessageCodec<dynamic> {
+ /// Creates a [MessageCodec] using the Flutter standard binary encoding.
+ const StandardMessageCodec();
+
// The codec serializes messages as outlined below. This format must
// match the Android and iOS counterparts.
//
@@ -264,9 +267,6 @@
static const int _valueList = 12;
static const int _valueMap = 13;
- /// Creates a [MessageCodec] using the Flutter standard binary encoding.
- const StandardMessageCodec();
-
@override
ByteData encodeMessage(dynamic message) {
if (message == null)
diff --git a/packages/flutter/lib/src/services/platform_views.dart b/packages/flutter/lib/src/services/platform_views.dart
index 0efb9c4..b32f182 100644
--- a/packages/flutter/lib/src/services/platform_views.dart
+++ b/packages/flutter/lib/src/services/platform_views.dart
@@ -97,21 +97,6 @@
///
/// A Dart version of Android's [MotionEvent.PointerProperties](https://developer.android.com/reference/android/view/MotionEvent.PointerProperties).
class AndroidPointerProperties {
- /// Value for `toolType` when the tool type is unknown.
- static const int kToolTypeUnknown = 0;
-
- /// Value for `toolType` when the tool type is a finger.
- static const int kToolTypeFinger = 1;
-
- /// Value for `toolType` when the tool type is a stylus.
- static const int kToolTypeStylus = 2;
-
- /// Value for `toolType` when the tool type is a mouse.
- static const int kToolTypeMouse = 3;
-
- /// Value for `toolType` when the tool type is an eraser.
- static const int kToolTypeEraser = 4;
-
/// Creates an AndroidPointerProperties.
///
/// All parameters must not be null.
@@ -128,6 +113,21 @@
/// See Android's [MotionEvent.PointerProperties#toolType](https://developer.android.com/reference/android/view/MotionEvent.PointerProperties.html#toolType).
final int toolType;
+ /// Value for `toolType` when the tool type is unknown.
+ static const int kToolTypeUnknown = 0;
+
+ /// Value for `toolType` when the tool type is a finger.
+ static const int kToolTypeFinger = 1;
+
+ /// Value for `toolType` when the tool type is a stylus.
+ static const int kToolTypeStylus = 2;
+
+ /// Value for `toolType` when the tool type is a mouse.
+ static const int kToolTypeMouse = 3;
+
+ /// Value for `toolType` when the tool type is an eraser.
+ static const int kToolTypeEraser = 4;
+
List<int> _asList() => <int>[id, toolType];
@override
diff --git a/packages/flutter/lib/src/services/system_chrome.dart b/packages/flutter/lib/src/services/system_chrome.dart
index d3e2f12..1bafea4 100644
--- a/packages/flutter/lib/src/services/system_chrome.dart
+++ b/packages/flutter/lib/src/services/system_chrome.dart
@@ -97,28 +97,6 @@
///
/// Used by [SystemChrome.setSystemUIOverlayStyle].
class SystemUiOverlayStyle {
- /// System overlays should be drawn with a light color. Intended for
- /// applications with a dark background.
- static const SystemUiOverlayStyle light = SystemUiOverlayStyle(
- systemNavigationBarColor: Color(0xFF000000),
- systemNavigationBarDividerColor: null,
- statusBarColor: null,
- systemNavigationBarIconBrightness: Brightness.light,
- statusBarIconBrightness: Brightness.light,
- statusBarBrightness: Brightness.dark,
- );
-
- /// System overlays should be drawn with a dark color. Intended for
- /// applications with a light background.
- static const SystemUiOverlayStyle dark = SystemUiOverlayStyle(
- systemNavigationBarColor: Color(0xFF000000),
- systemNavigationBarDividerColor: null,
- statusBarColor: null,
- systemNavigationBarIconBrightness: Brightness.light,
- statusBarIconBrightness: Brightness.dark,
- statusBarBrightness: Brightness.light,
- );
-
/// Creates a new [SystemUiOverlayStyle].
const SystemUiOverlayStyle({
this.systemNavigationBarColor,
@@ -159,6 +137,28 @@
/// Only honored in Android version M and greater.
final Brightness statusBarIconBrightness;
+ /// System overlays should be drawn with a light color. Intended for
+ /// applications with a dark background.
+ static const SystemUiOverlayStyle light = SystemUiOverlayStyle(
+ systemNavigationBarColor: Color(0xFF000000),
+ systemNavigationBarDividerColor: null,
+ statusBarColor: null,
+ systemNavigationBarIconBrightness: Brightness.light,
+ statusBarIconBrightness: Brightness.light,
+ statusBarBrightness: Brightness.dark,
+ );
+
+ /// System overlays should be drawn with a dark color. Intended for
+ /// applications with a light background.
+ static const SystemUiOverlayStyle dark = SystemUiOverlayStyle(
+ systemNavigationBarColor: Color(0xFF000000),
+ systemNavigationBarDividerColor: null,
+ statusBarColor: null,
+ systemNavigationBarIconBrightness: Brightness.light,
+ statusBarIconBrightness: Brightness.dark,
+ statusBarBrightness: Brightness.light,
+ );
+
/// Convert this event to a map for serialization.
Map<String, dynamic> _toMap() {
return <String, dynamic>{
diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart
index 13c4d16..36b7d81 100644
--- a/packages/flutter/lib/src/services/text_input.dart
+++ b/packages/flutter/lib/src/services/text_input.dart
@@ -698,6 +698,8 @@
/// An interface to the system's text input control.
class TextInput {
+ TextInput._();
+
static const List<TextInputAction> _androidSupportedInputActions = <TextInputAction>[
TextInputAction.none,
TextInputAction.unspecified,
@@ -724,8 +726,6 @@
TextInputAction.emergencyCall,
];
- TextInput._();
-
/// Begin interacting with the text input control.
///
/// Calling this function helps multiple clients coordinate about which one is
diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart
index 24c0d8f..29d1ee5 100644
--- a/packages/flutter/lib/src/widgets/basic.dart
+++ b/packages/flutter/lib/src/widgets/basic.dart
@@ -5564,17 +5564,17 @@
}) : assert(child != null),
super(key: key);
- /// The widget below this widget in the tree.
- ///
- /// {@macro flutter.widgets.child}
- final Widget child;
-
/// Creates a KeyedSubtree for child with a key that's based on the child's existing key or childIndex.
factory KeyedSubtree.wrap(Widget child, int childIndex) {
final Key key = child.key != null ? ValueKey<Key>(child.key) : ValueKey<int>(childIndex);
return KeyedSubtree(key: key, child: child);
}
+ /// The widget below this widget in the tree.
+ ///
+ /// {@macro flutter.widgets.child}
+ final Widget child;
+
/// Wrap each item in a KeyedSubtree whose key is based on the item's existing key or
/// the sum of its list index and `baseIndex`.
static List<Widget> ensureUniqueKeysForList(Iterable<Widget> items, { int baseIndex = 0 }) {
diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart
index 941de32..0df0634 100644
--- a/packages/flutter/lib/src/widgets/widget_inspector.dart
+++ b/packages/flutter/lib/src/widgets/widget_inspector.dart
@@ -49,10 +49,10 @@
/// A proxy layer is used for cases where a layer needs to be placed into
/// multiple trees of layers.
class _ProxyLayer extends Layer {
- final Layer _layer;
-
_ProxyLayer(this._layer);
+ final Layer _layer;
+
@override
void addToScene(ui.SceneBuilder builder, [Offset layerOffset = Offset.zero]) {
_layer.addToScene(builder, layerOffset);
@@ -66,9 +66,6 @@
/// secondary screenshot canvas so that a screenshot can be recorded at the same
/// time as performing a normal paint.
class _MulticastCanvas implements Canvas {
- final Canvas _main;
- final Canvas _screenshot;
-
_MulticastCanvas({
@required Canvas main,
@required Canvas screenshot,
@@ -77,6 +74,9 @@
_main = main,
_screenshot = screenshot;
+ final Canvas _main;
+ final Canvas _screenshot;
+
@override
void clipPath(Path path, {bool doAntiAlias = true}) {
_main.clipPath(path, doAntiAlias: doAntiAlias);
diff --git a/packages/flutter/test/material/time_picker_test.dart b/packages/flutter/test/material/time_picker_test.dart
index f3b79e5..daca36d 100644
--- a/packages/flutter/test/material/time_picker_test.dart
+++ b/packages/flutter/test/material/time_picker_test.dart
@@ -513,13 +513,13 @@
);
class _SemanticsNodeExpectation {
+ _SemanticsNodeExpectation(this.label, this.left, this.top, this.right, this.bottom);
+
final String label;
final double left;
final double top;
final double right;
final double bottom;
-
- _SemanticsNodeExpectation(this.label, this.left, this.top, this.right, this.bottom);
}
class _CustomPainterSemanticsTester {
diff --git a/packages/flutter/test/painting/fake_codec.dart b/packages/flutter/test/painting/fake_codec.dart
index 3ea014b..17e433d 100644
--- a/packages/flutter/test/painting/fake_codec.dart
+++ b/packages/flutter/test/painting/fake_codec.dart
@@ -14,13 +14,13 @@
/// This is useful for running in the test Zone, where it is tricky to receive
/// callbacks originating from the IO thread.
class FakeCodec implements ui.Codec {
+ FakeCodec._(this._frameCount, this._repetitionCount, this._frameInfos);
+
final int _frameCount;
final int _repetitionCount;
final List<ui.FrameInfo> _frameInfos;
int _nextFrame = 0;
- FakeCodec._(this._frameCount, this._repetitionCount, this._frameInfos);
-
/// Creates a FakeCodec from encoded image data.
///
/// Only call this method outside of the test zone.
diff --git a/packages/flutter/test/painting/image_resolution_test.dart b/packages/flutter/test/painting/image_resolution_test.dart
index 9099ae9..75a62c7 100644
--- a/packages/flutter/test/painting/image_resolution_test.dart
+++ b/packages/flutter/test/painting/image_resolution_test.dart
@@ -13,11 +13,10 @@
class TestAssetBundle extends CachingAssetBundle {
+ TestAssetBundle(this._assetBundleMap);
Map<String, List<String>> _assetBundleMap;
- TestAssetBundle(this._assetBundleMap);
-
Map<String, int> loadCallCount = <String, int>{};
String get _assetBundleContents {
diff --git a/packages/flutter/test/painting/image_stream_test.dart b/packages/flutter/test/painting/image_stream_test.dart
index 6c54351..40c89a4 100644
--- a/packages/flutter/test/painting/image_stream_test.dart
+++ b/packages/flutter/test/painting/image_stream_test.dart
@@ -11,12 +11,12 @@
import 'package:flutter_test/flutter_test.dart';
class FakeFrameInfo implements FrameInfo {
- final Duration _duration;
- final Image _image;
-
FakeFrameInfo(int width, int height, this._duration) :
_image = FakeImage(width, height);
+ final Duration _duration;
+ final Image _image;
+
@override
Duration get duration => _duration;
@@ -25,11 +25,11 @@
}
class FakeImage implements Image {
+ FakeImage(this._width, this._height);
+
final int _width;
final int _height;
- FakeImage(this._width, this._height);
-
@override
int get width => _width;
diff --git a/packages/flutter/test/rendering/mock_canvas.dart b/packages/flutter/test/rendering/mock_canvas.dart
index 5dc2cac..172801f 100644
--- a/packages/flutter/test/rendering/mock_canvas.dart
+++ b/packages/flutter/test/rendering/mock_canvas.dart
@@ -558,12 +558,12 @@
}
class _TestRecordingCanvasPaintsCountMatcher extends _TestRecordingCanvasMatcher {
- final Symbol _methodName;
- final int _count;
-
_TestRecordingCanvasPaintsCountMatcher(Symbol methodName, int count)
: _methodName = methodName, _count = count;
+ final Symbol _methodName;
+ final int _count;
+
@override
Description describe(Description description) {
return description.add('Object or closure painting $_methodName exactly $_count times');
diff --git a/packages/flutter/test/widgets/image_test.dart b/packages/flutter/test/widgets/image_test.dart
index 513b330..04fd69e 100644
--- a/packages/flutter/test/widgets/image_test.dart
+++ b/packages/flutter/test/widgets/image_test.dart
@@ -792,15 +792,15 @@
}
class TestImageProvider extends ImageProvider<TestImageProvider> {
- final Completer<ImageInfo> _completer = Completer<ImageInfo>();
- ImageStreamCompleter _streamCompleter;
- ImageConfiguration _lastResolvedConfiguration;
-
TestImageProvider({ImageStreamCompleter streamCompleter}) {
_streamCompleter = streamCompleter
?? OneFrameImageStreamCompleter(_completer.future);
}
+ final Completer<ImageInfo> _completer = Completer<ImageInfo>();
+ ImageStreamCompleter _streamCompleter;
+ ImageConfiguration _lastResolvedConfiguration;
+
@override
Future<TestImageProvider> obtainKey(ImageConfiguration configuration) {
return SynchronousFuture<TestImageProvider>(this);
diff --git a/packages/flutter_driver/lib/src/common/text.dart b/packages/flutter_driver/lib/src/common/text.dart
index c0d70b8..328c92d 100644
--- a/packages/flutter_driver/lib/src/common/text.dart
+++ b/packages/flutter_driver/lib/src/common/text.dart
@@ -41,14 +41,14 @@
/// Creates a command that enters text into the currently focused widget.
EnterText(this.text, { Duration timeout }) : super(timeout: timeout);
- /// The text extracted by the [GetText] command.
- final String text;
-
/// Deserializes this command from the value generated by [serialize].
EnterText.deserialize(Map<String, dynamic> json)
: text = json['text'],
super.deserialize(json);
+ /// The text extracted by the [GetText] command.
+ final String text;
+
@override
final String kind = 'enter_text';
@@ -77,14 +77,14 @@
/// Creates a command that enables and disables text entry emulation.
SetTextEntryEmulation(this.enabled, { Duration timeout }) : super(timeout: timeout);
- /// Whether text entry emulation should be enabled.
- final bool enabled;
-
/// Deserializes this command from the value generated by [serialize].
SetTextEntryEmulation.deserialize(Map<String, dynamic> json)
: enabled = json['enabled'] == 'true',
super.deserialize(json);
+ /// Whether text entry emulation should be enabled.
+ final bool enabled;
+
@override
final String kind = 'set_text_entry_emulation';
diff --git a/packages/flutter_driver/lib/src/driver/driver.dart b/packages/flutter_driver/lib/src/driver/driver.dart
index 5aa1e47..c4ab1b6 100644
--- a/packages/flutter_driver/lib/src/driver/driver.dart
+++ b/packages/flutter_driver/lib/src/driver/driver.dart
@@ -770,6 +770,9 @@
/// Encapsulates connection information to an instance of a Flutter application.
@visibleForTesting
class VMServiceClientConnection {
+ /// Creates an instance of this class given a [client] and a [peer].
+ VMServiceClientConnection(this.client, this.peer);
+
/// Use this for structured access to the VM service's public APIs.
final VMServiceClient client;
@@ -778,9 +781,6 @@
/// This object allows reaching into private VM service APIs. Use with
/// caution.
final rpc.Peer peer;
-
- /// Creates an instance of this class given a [client] and a [peer].
- VMServiceClientConnection(this.client, this.peer);
}
/// A function that connects to a Dart VM service given the [url].
diff --git a/packages/flutter_driver/lib/src/extension/extension.dart b/packages/flutter_driver/lib/src/extension/extension.dart
index 3adb1d5..cc3f0a8 100644
--- a/packages/flutter_driver/lib/src/extension/extension.dart
+++ b/packages/flutter_driver/lib/src/extension/extension.dart
@@ -92,8 +92,6 @@
/// calling [enableFlutterDriverExtension].
@visibleForTesting
class FlutterDriverExtension {
- final TestTextInput _testTextInput = TestTextInput();
-
/// Creates an object to manage a Flutter Driver connection.
FlutterDriverExtension(this._requestDataHandler, this._silenceErrors) {
_testTextInput.register();
@@ -143,6 +141,8 @@
});
}
+ final TestTextInput _testTextInput = TestTextInput();
+
final DataHandler _requestDataHandler;
final bool _silenceErrors;
diff --git a/packages/flutter_tools/lib/src/android/android_studio.dart b/packages/flutter_tools/lib/src/android/android_studio.dart
index 932433b..00f0dda 100644
--- a/packages/flutter_tools/lib/src/android/android_studio.dart
+++ b/packages/flutter_tools/lib/src/android/android_studio.dart
@@ -36,16 +36,6 @@
_init();
}
- final String directory;
- final String studioAppName;
- final Version version;
- final String configured;
-
- String _pluginsPath;
- String _javaPath;
- bool _isValid = false;
- final List<String> _validationMessages = <String>[];
-
factory AndroidStudio.fromMacOSBundle(String bundlePath) {
final String studioPath = fs.path.join(bundlePath, 'Contents');
final String plistFile = fs.path.join(studioPath, 'Info.plist');
@@ -89,6 +79,16 @@
return null;
}
+ final String directory;
+ final String studioAppName;
+ final Version version;
+ final String configured;
+
+ String _pluginsPath;
+ String _javaPath;
+ bool _isValid = false;
+ final List<String> _validationMessages = <String>[];
+
String get javaPath => _javaPath;
bool get isValid => _isValid;
diff --git a/packages/flutter_tools/lib/src/android/android_studio_validator.dart b/packages/flutter_tools/lib/src/android/android_studio_validator.dart
index 3302e94..b12d338 100644
--- a/packages/flutter_tools/lib/src/android/android_studio_validator.dart
+++ b/packages/flutter_tools/lib/src/android/android_studio_validator.dart
@@ -11,10 +11,10 @@
import 'android_studio.dart';
class AndroidStudioValidator extends DoctorValidator {
- final AndroidStudio _studio;
-
AndroidStudioValidator(this._studio) : super('Android Studio');
+ final AndroidStudio _studio;
+
static List<DoctorValidator> get allValidators {
final List<DoctorValidator> validators = <DoctorValidator>[];
final List<AndroidStudio> studios = AndroidStudio.allInstalled();
diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart
index 03fbd9b..fc16897 100644
--- a/packages/flutter_tools/lib/src/application_package.dart
+++ b/packages/flutter_tools/lib/src/application_package.dart
@@ -21,12 +21,12 @@
import 'tester/flutter_tester.dart';
abstract class ApplicationPackage {
- /// Package ID from the Android Manifest or equivalent.
- final String id;
-
ApplicationPackage({ @required this.id })
: assert(id != null);
+ /// Package ID from the Android Manifest or equivalent.
+ final String id;
+
String get name;
String get displayName => name;
@@ -38,12 +38,6 @@
}
class AndroidApk extends ApplicationPackage {
- /// Path to the actual apk file.
- final File file;
-
- /// The path to the activity that should be launched.
- final String launchActivity;
-
AndroidApk({
String id,
@required this.file,
@@ -88,6 +82,12 @@
);
}
+ /// Path to the actual apk file.
+ final File file;
+
+ /// The path to the activity that should be launched.
+ final String launchActivity;
+
/// Creates a new AndroidApk based on the information in the Android manifest.
static Future<AndroidApk> fromAndroidProject(AndroidProject androidProject) async {
File apkFile;
@@ -250,15 +250,15 @@
}
class PrebuiltIOSApp extends IOSApp {
- final Directory bundleDir;
- final String bundleName;
-
PrebuiltIOSApp({
this.bundleDir,
this.bundleName,
@required String projectBundleId,
}) : super(projectBundleId: projectBundleId);
+ final Directory bundleDir;
+ final String bundleName;
+
@override
String get name => bundleName;
@@ -299,11 +299,11 @@
}
class ApplicationPackageStore {
+ ApplicationPackageStore({ this.android, this.iOS });
+
AndroidApk android;
IOSApp iOS;
- ApplicationPackageStore({ this.android, this.iOS });
-
Future<ApplicationPackage> getPackageForPlatform(TargetPlatform platform) async {
switch (platform) {
case TargetPlatform.android_arm:
@@ -332,9 +332,6 @@
}
class _Element extends _Entry {
- List<_Entry> children;
- String name;
-
_Element.fromLine(String line, _Element parent) {
// E: application (line=29)
final List<String> parts = line.trimLeft().split(' ');
@@ -344,6 +341,9 @@
children = <_Entry>[];
}
+ List<_Entry> children;
+ String name;
+
void addChild(_Entry child) {
children.add(child);
}
@@ -369,9 +369,6 @@
}
class _Attribute extends _Entry {
- String key;
- String value;
-
_Attribute.fromLine(String line, _Element parent) {
// A: android:label(0x01010001)="hello_world" (Raw: "hello_world")
const String attributePrefix = 'A: ';
@@ -383,6 +380,9 @@
level = line.length - line.trimLeft().length;
this.parent = parent;
}
+
+ String key;
+ String value;
}
class ApkManifestData {
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart
index 9ad2d9b..59c20c7 100644
--- a/packages/flutter_tools/lib/src/artifacts.dart
+++ b/packages/flutter_tools/lib/src/artifacts.dart
@@ -231,12 +231,12 @@
/// Manages the artifacts of a locally built engine.
class LocalEngineArtifacts extends Artifacts {
+ LocalEngineArtifacts(this._engineSrcPath, this.engineOutPath, this._hostEngineOutPath);
+
final String _engineSrcPath;
final String engineOutPath; // TODO(goderbauer): This should be private.
String _hostEngineOutPath;
- LocalEngineArtifacts(this._engineSrcPath, this.engineOutPath, this._hostEngineOutPath);
-
@override
String getArtifactPath(Artifact artifact, [TargetPlatform platform, BuildMode mode]) {
switch (artifact) {
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index 5052e5d..871c882 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -56,21 +56,21 @@
}
class _ManifestAssetBundle implements AssetBundle {
+ /// Constructs an [_ManifestAssetBundle] that gathers the set of assets from the
+ /// pubspec.yaml manifest.
+ _ManifestAssetBundle();
+
@override
final Map<String, DevFSContent> entries = <String, DevFSContent>{};
+ DateTime _lastBuildTimestamp;
+
static const String defaultManifestPath = 'pubspec.yaml';
static const String _assetManifestJson = 'AssetManifest.json';
static const String _fontManifestJson = 'FontManifest.json';
static const String _fontSetMaterial = 'material';
static const String _license = 'LICENSE';
- DateTime _lastBuildTimestamp;
-
- /// Constructs an [_ManifestAssetBundle] that gathers the set of assets from the
- /// pubspec.yaml manifest.
- _ManifestAssetBundle();
-
@override
bool wasBuiltOnce() => _lastBuildTimestamp != null;
diff --git a/packages/flutter_tools/lib/src/base/version.dart b/packages/flutter_tools/lib/src/base/version.dart
index 663c43e..80ad3f0 100644
--- a/packages/flutter_tools/lib/src/base/version.dart
+++ b/packages/flutter_tools/lib/src/base/version.dart
@@ -3,24 +3,6 @@
// found in the LICENSE file.
class Version implements Comparable<Version> {
- static final RegExp versionPattern =
- RegExp(r'^(\d+)(\.(\d+)(\.(\d+))?)?');
-
- /// The major version number: "1" in "1.2.3".
- final int major;
-
- /// The minor version number: "2" in "1.2.3".
- final int minor;
-
- /// The patch version number: "3" in "1.2.3".
- final int patch;
-
- /// The original string representation of the version number.
- ///
- /// This preserves textual artifacts like leading zeros that may be left out
- /// of the parsed version.
- final String _text;
-
/// Creates a new [Version] object.
factory Version(int major, int minor, int patch, {String text}) {
if (text == null) {
@@ -76,6 +58,24 @@
static Version get unknown => Version(0, 0, 0, text: 'unknown');
+ /// The major version number: "1" in "1.2.3".
+ final int major;
+
+ /// The minor version number: "2" in "1.2.3".
+ final int minor;
+
+ /// The patch version number: "3" in "1.2.3".
+ final int patch;
+
+ /// The original string representation of the version number.
+ ///
+ /// This preserves textual artifacts like leading zeros that may be left out
+ /// of the parsed version.
+ final String _text;
+
+ static final RegExp versionPattern =
+ RegExp(r'^(\d+)(\.(\d+)(\.(\d+))?)?');
+
/// Two [Version]s are equal if their version numbers are. The version text
/// is ignored.
@override
diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart
index 04547d2..e10f96f 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_base.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart
@@ -15,11 +15,11 @@
/// Common behavior for `flutter analyze` and `flutter analyze --watch`
abstract class AnalyzeBase {
+ AnalyzeBase(this.argResults);
+
/// The parsed argument results for execution.
final ArgResults argResults;
- AnalyzeBase(this.argResults);
-
/// Called by [AnalyzeCommand] to start the analysis process.
Future<Null> analyze();
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart
index 18d38bc..de16efb 100644
--- a/packages/flutter_tools/lib/src/commands/daemon.dart
+++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -819,14 +819,14 @@
/// This domain responds to methods like [getEmulators] and [launch].
class EmulatorDomain extends Domain {
- EmulatorManager emulators = EmulatorManager();
-
EmulatorDomain(Daemon daemon) : super(daemon, 'emulator') {
registerHandler('getEmulators', getEmulators);
registerHandler('launch', launch);
registerHandler('create', create);
}
+ EmulatorManager emulators = EmulatorManager();
+
Future<List<Map<String, dynamic>>> getEmulators([Map<String, dynamic> args]) async {
final List<Emulator> list = await emulators.getAllAvailableEmulators();
return list.map<Map<String, dynamic>>(_emulatorToMap).toList();
@@ -971,9 +971,9 @@
}
class LogMessage {
+ LogMessage(this.level, this.message, [this.stackTrace]);
+
final String level;
final String message;
final StackTrace stackTrace;
-
- LogMessage(this.level, this.message, [this.stackTrace]);
}
diff --git a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
index 3979beb..9bb14cf 100644
--- a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
+++ b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
@@ -444,18 +444,18 @@
// VM service running on a Fuchsia device. [process] is the ssh process running
// the tunnel and [port] is the local port.
class _PortForwarder {
- final String _remoteAddress;
- final int _remotePort;
- final int _localPort;
- final Process _process;
- final String _sshConfig;
-
_PortForwarder._(this._remoteAddress,
this._remotePort,
this._localPort,
this._process,
this._sshConfig);
+ final String _remoteAddress;
+ final int _remotePort;
+ final int _localPort;
+ final Process _process;
+ final String _sshConfig;
+
int get port => _localPort;
static Future<_PortForwarder> start(String sshConfig,
@@ -519,11 +519,11 @@
}
class FuchsiaDeviceCommandRunner {
+ FuchsiaDeviceCommandRunner(this._address, this._sshConfig);
+
final String _address;
final String _sshConfig;
- FuchsiaDeviceCommandRunner(this._address, this._sshConfig);
-
Future<List<String>> run(String command) async {
final List<String> args = <String>['ssh', '-F', _sshConfig, _address, command];
printTrace(args.join(' '));
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index 36efd98..40c3548 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -72,12 +72,6 @@
}
class RunCommand extends RunCommandBase {
- @override
- final String name = 'run';
-
- @override
- final String description = 'Run your Flutter app on an attached device.';
-
RunCommand({ bool verboseHelp = false }) : super(verboseHelp: verboseHelp) {
requiresPubspecYaml();
usesFilesystemOptions(hide: !verboseHelp);
@@ -179,6 +173,12 @@
..addOption(FlutterOptions.kExtraGenSnapshotOptions, hide: true);
}
+ @override
+ final String name = 'run';
+
+ @override
+ final String description = 'Run your Flutter app on an attached device.';
+
List<Device> devices;
@override
diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart
index a3c6930..9ae0778 100644
--- a/packages/flutter_tools/lib/src/compile.dart
+++ b/packages/flutter_tools/lib/src/compile.dart
@@ -21,10 +21,10 @@
typedef CompilerMessageConsumer = void Function(String message, {bool emphasis, TerminalColor color});
class CompilerOutput {
+ const CompilerOutput(this.outputFilename, this.errorCount);
+
final String outputFilename;
final int errorCount;
-
- const CompilerOutput(this.outputFilename, this.errorCount);
}
class _StdoutHandler {
@@ -198,10 +198,10 @@
/// Class that allows to serialize compilation requests to the compiler.
abstract class _CompilationRequest {
- Completer<CompilerOutput> completer;
-
_CompilationRequest(this.completer);
+ Completer<CompilerOutput> completer;
+
Future<CompilerOutput> _run(ResidentCompiler compiler);
Future<void> run(ResidentCompiler compiler) async {
diff --git a/packages/flutter_tools/lib/src/crash_reporting.dart b/packages/flutter_tools/lib/src/crash_reporting.dart
index 9018cee..b353780 100644
--- a/packages/flutter_tools/lib/src/crash_reporting.dart
+++ b/packages/flutter_tools/lib/src/crash_reporting.dart
@@ -48,10 +48,10 @@
/// * In tests call [initializeWith] and provide a mock implementation of
/// [http.Client].
class CrashReportSender {
- static CrashReportSender _instance;
-
CrashReportSender._(this._client);
+ static CrashReportSender _instance;
+
static CrashReportSender get instance => _instance ?? CrashReportSender._(http.Client());
/// Overrides the default [http.Client] with [client] for testing purposes.
diff --git a/packages/flutter_tools/lib/src/dart/pub.dart b/packages/flutter_tools/lib/src/dart/pub.dart
index b4b6e6b..b318302 100644
--- a/packages/flutter_tools/lib/src/dart/pub.dart
+++ b/packages/flutter_tools/lib/src/dart/pub.dart
@@ -23,7 +23,17 @@
// DO NOT update without contacting kevmoo.
// We have server-side tooling that assumes the values are consistent.
class PubContext {
- static final RegExp _validContext = RegExp('[a-z][a-z_]*[a-z]');
+ PubContext._(this._values) {
+ for (String item in _values) {
+ if (!_validContext.hasMatch(item)) {
+ throw ArgumentError.value(
+ _values, 'value', 'Must match RegExp ${_validContext.pattern}');
+ }
+ }
+ }
+
+ static PubContext getVerifyContext(String commandName) =>
+ PubContext._(<String>['verify', commandName.replaceAll('-', '_')]);
static final PubContext create = PubContext._(<String>['create']);
static final PubContext createPackage = PubContext._(<String>['create_pkg']);
@@ -38,17 +48,7 @@
final List<String> _values;
- PubContext._(this._values) {
- for (String item in _values) {
- if (!_validContext.hasMatch(item)) {
- throw ArgumentError.value(
- _values, 'value', 'Must match RegExp ${_validContext.pattern}');
- }
- }
- }
-
- static PubContext getVerifyContext(String commandName) =>
- PubContext._(<String>['verify', commandName.replaceAll('-', '_')]);
+ static final RegExp _validContext = RegExp('[a-z][a-z_]*[a-z]');
@override
String toString() => 'PubContext: ${_values.join(':')}';
diff --git a/packages/flutter_tools/lib/src/dependency_checker.dart b/packages/flutter_tools/lib/src/dependency_checker.dart
index 8316443..bcc9407 100644
--- a/packages/flutter_tools/lib/src/dependency_checker.dart
+++ b/packages/flutter_tools/lib/src/dependency_checker.dart
@@ -8,10 +8,11 @@
import 'globals.dart';
class DependencyChecker {
+ DependencyChecker(this.builder, this.assets);
+
final DartDependencySetBuilder builder;
final Set<String> _dependencies = Set<String>();
final AssetBundle assets;
- DependencyChecker(this.builder, this.assets);
/// Returns [true] if any components have been modified after [threshold] or
/// if it cannot be determined.
diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart
index 3dd8819..54b7107 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -201,10 +201,10 @@
/// An implementation of [DevFSOperations] that speaks to the
/// vm service.
class ServiceProtocolDevFSOperations implements DevFSOperations {
- final VMService vmService;
-
ServiceProtocolDevFSOperations(this.vmService);
+ final VMService vmService;
+
@override
Future<Uri> create(String fsName) async {
final Map<String, dynamic> response = await vmService.vm.createDevFS(fsName);
diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart
index d0fcf2f..ca10b6e 100644
--- a/packages/flutter_tools/lib/src/doctor.dart
+++ b/packages/flutter_tools/lib/src/doctor.dart
@@ -420,10 +420,10 @@
}
abstract class IntelliJValidator extends DoctorValidator {
- final String installPath;
-
IntelliJValidator(String title, this.installPath) : super(title);
+ final String installPath;
+
String get version;
String get pluginsPath;
@@ -644,10 +644,10 @@
}
class ValidatorWithResult extends DoctorValidator {
- final ValidationResult result;
-
ValidatorWithResult(String title, this.result) : super(title);
+ final ValidationResult result;
+
@override
Future<ValidationResult> validate() async => result;
}
diff --git a/packages/flutter_tools/lib/src/emulator.dart b/packages/flutter_tools/lib/src/emulator.dart
index 42e63fe..51d0706 100644
--- a/packages/flutter_tools/lib/src/emulator.dart
+++ b/packages/flutter_tools/lib/src/emulator.dart
@@ -277,10 +277,10 @@
}
class CreateEmulatorResult {
+ CreateEmulatorResult(this.emulatorName, {this.success, this.output, this.error});
+
final bool success;
final String emulatorName;
final String output;
final String error;
-
- CreateEmulatorResult(this.emulatorName, {this.success, this.output, this.error});
}
diff --git a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
index 0c02bcc..7609979 100644
--- a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+++ b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
@@ -10,10 +10,10 @@
/// Read the log for a particular device.
class _FuchsiaLogReader extends DeviceLogReader {
- FuchsiaDevice _device;
-
_FuchsiaLogReader(this._device);
+ FuchsiaDevice _device;
+
@override String get name => _device.name;
Stream<String> _logLines;
diff --git a/packages/flutter_tools/lib/src/intellij/intellij.dart b/packages/flutter_tools/lib/src/intellij/intellij.dart
index 03f2d0f..46278ba 100644
--- a/packages/flutter_tools/lib/src/intellij/intellij.dart
+++ b/packages/flutter_tools/lib/src/intellij/intellij.dart
@@ -11,11 +11,11 @@
import '../doctor.dart';
class IntelliJPlugins {
- static final Version kMinFlutterPluginVersion = Version(16, 0, 0);
+ IntelliJPlugins(this.pluginsPath);
final String pluginsPath;
- IntelliJPlugins(this.pluginsPath);
+ static final Version kMinFlutterPluginVersion = Version(16, 0, 0);
void validatePackage(
List<ValidationMessage> messages, List<String> packageNames, String title,
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index d9f4e26..f567692 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -440,11 +440,6 @@
}
class _IOSDeviceLogReader extends DeviceLogReader {
- // Matches a syslog line from the runner.
- RegExp _runnerLineRegex;
- // Matches a syslog line from any app.
- RegExp _anyLineRegex;
-
_IOSDeviceLogReader(this.device, ApplicationPackage app) {
_linesController = StreamController<String>.broadcast(
onListen: _start,
@@ -465,6 +460,11 @@
final IOSDevice device;
+ // Matches a syslog line from the runner.
+ RegExp _runnerLineRegex;
+ // Matches a syslog line from any app.
+ RegExp _anyLineRegex;
+
StreamController<String> _linesController;
Process _process;
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index 77dd9d4..ea830e3 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -482,8 +482,6 @@
}
class _IOSSimulatorLogReader extends DeviceLogReader {
- String _appName;
-
_IOSSimulatorLogReader(this.device, IOSApp app) {
_linesController = StreamController<String>.broadcast(
onListen: _start,
@@ -494,6 +492,8 @@
final IOSSimulator device;
+ String _appName;
+
StreamController<String> _linesController;
// We log from two files: the device and the system log.
diff --git a/packages/flutter_tools/lib/src/plugins.dart b/packages/flutter_tools/lib/src/plugins.dart
index 2b959c7..cd4827b 100644
--- a/packages/flutter_tools/lib/src/plugins.dart
+++ b/packages/flutter_tools/lib/src/plugins.dart
@@ -22,12 +22,6 @@
}
class Plugin {
- final String name;
- final String path;
- final String androidPackage;
- final String iosPrefix;
- final String pluginClass;
-
Plugin({
this.name,
this.path,
@@ -53,6 +47,12 @@
pluginClass: pluginClass,
);
}
+
+ final String name;
+ final String path;
+ final String androidPackage;
+ final String iosPrefix;
+ final String pluginClass;
}
Plugin _pluginFromPubspec(String name, Uri packageRoot) {
diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart
index 0654611..3f94c80 100644
--- a/packages/flutter_tools/lib/src/project.dart
+++ b/packages/flutter_tools/lib/src/project.dart
@@ -148,15 +148,15 @@
/// Instances will reflect the contents of the `ios/` sub-folder of
/// Flutter applications and the `.ios/` sub-folder of Flutter modules.
class IosProject {
- static final RegExp _productBundleIdPattern = RegExp(r'^\s*PRODUCT_BUNDLE_IDENTIFIER\s*=\s*(.*);\s*$');
- static const String _productBundleIdVariable = r'$(PRODUCT_BUNDLE_IDENTIFIER)';
- static const String _hostAppBundleName = 'Runner';
-
IosProject._(this.parent);
/// The parent of this project.
final FlutterProject parent;
+ static final RegExp _productBundleIdPattern = RegExp(r'^\s*PRODUCT_BUNDLE_IDENTIFIER\s*=\s*(.*);\s*$');
+ static const String _productBundleIdVariable = r'$(PRODUCT_BUNDLE_IDENTIFIER)';
+ static const String _hostAppBundleName = 'Runner';
+
Directory get _ephemeralDirectory => parent.directory.childDirectory('.ios');
Directory get _editableDirectory => parent.directory.childDirectory('ios');
@@ -321,14 +321,14 @@
/// Instances will reflect the contents of the `android/` sub-folder of
/// Flutter applications and the `.android/` sub-folder of Flutter modules.
class AndroidProject {
- static final RegExp _applicationIdPattern = RegExp('^\\s*applicationId\\s+[\'\"](.*)[\'\"]\\s*\$');
- static final RegExp _groupPattern = RegExp('^\\s*group\\s+[\'\"](.*)[\'\"]\\s*\$');
-
AndroidProject._(this.parent);
/// The parent of this project.
final FlutterProject parent;
+ static final RegExp _applicationIdPattern = RegExp('^\\s*applicationId\\s+[\'\"](.*)[\'\"]\\s*\$');
+ static final RegExp _groupPattern = RegExp('^\\s*group\\s+[\'\"](.*)[\'\"]\\s*\$');
+
/// The Gradle root directory of the Android host app. This is the directory
/// containing the `app/` subdirectory and the `settings.gradle` file that
/// includes it in the overall Gradle project.
diff --git a/packages/flutter_tools/lib/src/tester/flutter_tester.dart b/packages/flutter_tools/lib/src/tester/flutter_tester.dart
index 4e5ff5f..219d46b 100644
--- a/packages/flutter_tools/lib/src/tester/flutter_tester.dart
+++ b/packages/flutter_tools/lib/src/tester/flutter_tester.dart
@@ -22,8 +22,6 @@
import '../version.dart';
class FlutterTesterApp extends ApplicationPackage {
- final Directory _directory;
-
factory FlutterTesterApp.fromCurrentDirectory() {
return FlutterTesterApp._(fs.currentDirectory);
}
@@ -32,6 +30,8 @@
: _directory = directory,
super(id: directory.path);
+ final Directory _directory;
+
@override
String get name => _directory.basename;
diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart
index 98612c0..da54493 100644
--- a/packages/flutter_tools/lib/src/version.dart
+++ b/packages/flutter_tools/lib/src/version.dart
@@ -368,10 +368,6 @@
/// Contains data and load/save logic pertaining to Flutter version checks.
@visibleForTesting
class VersionCheckStamp {
- /// The prefix of the stamp file where we cache Flutter version check data.
- @visibleForTesting
- static const String kFlutterVersionCheckStampFile = 'flutter_version_check';
-
const VersionCheckStamp({
this.lastTimeVersionWasChecked,
this.lastKnownRemoteVersion,
@@ -382,6 +378,10 @@
final DateTime lastKnownRemoteVersion;
final DateTime lastTimeWarningWasPrinted;
+ /// The prefix of the stamp file where we cache Flutter version check data.
+ @visibleForTesting
+ static const String kFlutterVersionCheckStampFile = 'flutter_version_check';
+
static Future<VersionCheckStamp> load() async {
final String versionCheckStamp = Cache.instance.getStampFor(kFlutterVersionCheckStampFile);
diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart
index 0fa50cb..e76b963 100644
--- a/packages/flutter_tools/lib/src/vmservice.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -559,7 +559,20 @@
}
class ServiceEvent extends ServiceObject {
- /// The possible 'kind' values.
+ ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner);
+
+ String _kind;
+ String get kind => _kind;
+ DateTime _timestamp;
+ DateTime get timestamp => _timestamp;
+ String _extensionKind;
+ String get extensionKind => _extensionKind;
+ Map<String, dynamic> _extensionData;
+ Map<String, dynamic> get extensionData => _extensionData;
+ List<Map<String, dynamic>> _timelineEvents;
+ List<Map<String, dynamic>> get timelineEvents => _timelineEvents;
+
+ // The possible 'kind' values.
static const String kVMUpdate = 'VMUpdate';
static const String kIsolateStart = 'IsolateStart';
static const String kIsolateRunnable = 'IsolateRunnable';
@@ -587,19 +600,6 @@
static const String kLogging = '_Logging';
static const String kExtension = 'Extension';
- ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner);
-
- String _kind;
- String get kind => _kind;
- DateTime _timestamp;
- DateTime get timestamp => _timestamp;
- String _extensionKind;
- String get extensionKind => _extensionKind;
- Map<String, dynamic> _extensionData;
- Map<String, dynamic> get extensionData => _extensionData;
- List<Map<String, dynamic>> _timelineEvents;
- List<Map<String, dynamic>> get timelineEvents => _timelineEvents;
-
@override
void _update(Map<String, dynamic> map, bool mapIsRef) {
_loaded = true;
diff --git a/packages/flutter_tools/lib/src/vmservice_record_replay.dart b/packages/flutter_tools/lib/src/vmservice_record_replay.dart
index 49dd7c3..0126f87 100644
--- a/packages/flutter_tools/lib/src/vmservice_record_replay.dart
+++ b/packages/flutter_tools/lib/src/vmservice_record_replay.dart
@@ -22,11 +22,6 @@
/// A [StreamChannel] that expects VM service (JSON-rpc) protocol messages and
/// serializes all such messages to the file system for later playback.
class RecordingVMServiceChannel extends DelegatingStreamChannel<String> {
- final List<_Message> _messages = <_Message>[];
-
- _RecordingStream _streamRecorder;
- _RecordingSink _sinkRecorder;
-
RecordingVMServiceChannel(StreamChannel<String> delegate, Directory location)
: super(delegate) {
addShutdownHook(() async {
@@ -41,6 +36,11 @@
}, ShutdownStage.SERIALIZE_RECORDING);
}
+ final List<_Message> _messages = <_Message>[];
+
+ _RecordingStream _streamRecorder;
+ _RecordingSink _sinkRecorder;
+
@override
Stream<String> get stream {
_streamRecorder ??= _RecordingStream(super.stream, _messages);
@@ -53,9 +53,6 @@
/// Base class for request and response JSON-rpc messages.
abstract class _Message implements Comparable<_Message> {
- final String type;
- final Map<String, dynamic> data;
-
_Message(this.type, this.data);
factory _Message.fromRecording(Map<String, dynamic> recordingData) {
@@ -64,6 +61,9 @@
: _Response(recordingData[_kData]);
}
+ final String type;
+ final Map<String, dynamic> data;
+
int get id => data[_kId];
/// Allows [JsonEncoder] to properly encode objects of this type.
@@ -115,11 +115,6 @@
/// A helper class that monitors a [Stream] of VM service JSON-rpc responses
/// and saves the responses to a recording.
class _RecordingStream {
- final Stream<String> _delegate;
- final StreamController<String> _controller;
- final List<_Message> _recording;
- StreamSubscription<String> _subscription;
-
_RecordingStream(Stream<String> stream, this._recording)
: _delegate = stream,
_controller = stream.isBroadcast
@@ -144,6 +139,11 @@
};
}
+ final Stream<String> _delegate;
+ final StreamController<String> _controller;
+ final List<_Message> _recording;
+ StreamSubscription<String> _subscription;
+
StreamSubscription<String> _listenToStream() {
return _delegate.listen(
(String element) {
@@ -162,11 +162,11 @@
/// A [StreamSink] that monitors VM service JSON-rpc requests and saves the
/// requests to a recording.
class _RecordingSink implements StreamSink<String> {
+ _RecordingSink(this._delegate, this._recording);
+
final StreamSink<String> _delegate;
final List<_Message> _recording;
- _RecordingSink(this._delegate, this._recording);
-
@override
Future<dynamic> close() => _delegate.close();
@@ -194,13 +194,13 @@
/// to its [StreamChannel.sink], looks up those requests in a recording, and
/// replays the corresponding responses back from the recording.
class ReplayVMServiceChannel extends StreamChannelMixin<String> {
+ ReplayVMServiceChannel(Directory location)
+ : _transactions = _loadTransactions(location);
+
final Map<int, _Transaction> _transactions;
final StreamController<String> _controller = StreamController<String>();
_ReplaySink _replaySink;
- ReplayVMServiceChannel(Directory location)
- : _transactions = _loadTransactions(location);
-
static Map<int, _Transaction> _loadTransactions(Directory location) {
final File file = _getManifest(location);
final String jsonData = file.readAsStringSync();
@@ -250,11 +250,11 @@
}
class _ReplaySink implements StreamSink<String> {
+ _ReplaySink(this.channel);
+
final ReplayVMServiceChannel channel;
final Completer<Null> _completer = Completer<Null>();
- _ReplaySink(this.channel);
-
@override
Future<dynamic> close() {
_completer.complete();
diff --git a/packages/flutter_tools/lib/src/vscode/vscode.dart b/packages/flutter_tools/lib/src/vscode/vscode.dart
index e92b9e3..3ed7586 100644
--- a/packages/flutter_tools/lib/src/vscode/vscode.dart
+++ b/packages/flutter_tools/lib/src/vscode/vscode.dart
@@ -45,17 +45,6 @@
}
}
- final String directory;
- final String extensionDirectory;
- final Version version;
- final String edition;
-
- static const String extensionIdentifier = 'Dart-Code.flutter';
-
- bool _isValid = false;
- Version _extensionVersion;
- final List<String> _validationMessages = <String>[];
-
factory VsCode.fromDirectory(String installPath, String extensionDirectory,
{ String edition }) {
final String packageJsonPath =
@@ -67,6 +56,17 @@
return VsCode._(installPath, extensionDirectory, version: version, edition: edition);
}
+ final String directory;
+ final String extensionDirectory;
+ final Version version;
+ final String edition;
+
+ static const String extensionIdentifier = 'Dart-Code.flutter';
+
+ bool _isValid = false;
+ Version _extensionVersion;
+ final List<String> _validationMessages = <String>[];
+
bool get isValid => _isValid;
String get productName => 'VS Code' + (edition != null ? ', $edition' : '');
diff --git a/packages/flutter_tools/lib/src/vscode/vscode_validator.dart b/packages/flutter_tools/lib/src/vscode/vscode_validator.dart
index b93e1d0..3d95170 100644
--- a/packages/flutter_tools/lib/src/vscode/vscode_validator.dart
+++ b/packages/flutter_tools/lib/src/vscode/vscode_validator.dart
@@ -9,11 +9,12 @@
import 'vscode.dart';
class VsCodeValidator extends DoctorValidator {
- static const String extensionMarketplaceUrl =
- 'https://marketplace.visualstudio.com/items?itemName=${VsCode.extensionIdentifier}';
+ VsCodeValidator(this._vsCode) : super(_vsCode.productName);
+
final VsCode _vsCode;
- VsCodeValidator(this._vsCode) : super(_vsCode.productName);
+ static const String extensionMarketplaceUrl =
+ 'https://marketplace.visualstudio.com/items?itemName=${VsCode.extensionIdentifier}';
static Iterable<DoctorValidator> get installedValidators {
return VsCode
diff --git a/packages/flutter_tools/test/commands/doctor_test.dart b/packages/flutter_tools/test/commands/doctor_test.dart
index 7e37463..ea49e34 100644
--- a/packages/flutter_tools/test/commands/doctor_test.dart
+++ b/packages/flutter_tools/test/commands/doctor_test.dart
@@ -510,18 +510,17 @@
/// A doctor that takes any two validators. Used to check behavior when
/// merging ValidationTypes (installed, missing, partial).
class FakeSmallGroupDoctor extends Doctor {
- List<DoctorValidator> _validators;
FakeSmallGroupDoctor(DoctorValidator val1, DoctorValidator val2) {
_validators = <DoctorValidator>[GroupedValidator(<DoctorValidator>[val1, val2])];
}
+
+ List<DoctorValidator> _validators;
+
@override
List<DoctorValidator> get validators => _validators;
}
class VsCodeValidatorTestTargets extends VsCodeValidator {
- static final String validInstall = fs.path.join('test', 'data', 'vscode', 'application');
- static final String validExtensions = fs.path.join('test', 'data', 'vscode', 'extensions');
- static final String missingExtensions = fs.path.join('test', 'data', 'vscode', 'notExtensions');
VsCodeValidatorTestTargets._(String installDirectory, String extensionDirectory, {String edition})
: super(VsCode.fromDirectory(installDirectory, extensionDirectory, edition: edition));
@@ -533,4 +532,8 @@
static VsCodeValidatorTestTargets get installedWithoutExtension =>
VsCodeValidatorTestTargets._(validInstall, missingExtensions);
+
+ static final String validInstall = fs.path.join('test', 'data', 'vscode', 'application');
+ static final String validExtensions = fs.path.join('test', 'data', 'vscode', 'extensions');
+ static final String missingExtensions = fs.path.join('test', 'data', 'vscode', 'notExtensions');
}
diff --git a/packages/flutter_tools/test/dart/pub_get_test.dart b/packages/flutter_tools/test/dart/pub_get_test.dart
index 16e23f3..ec4773f 100644
--- a/packages/flutter_tools/test/dart/pub_get_test.dart
+++ b/packages/flutter_tools/test/dart/pub_get_test.dart
@@ -251,13 +251,13 @@
}
class MockDirectory implements Directory {
- static bool findCache = false;
-
MockDirectory(this.path);
@override
final String path;
+ static bool findCache = false;
+
@override
bool existsSync() => findCache && path.endsWith('.pub-cache');
diff --git a/packages/flutter_tools/test/devfs_test.dart b/packages/flutter_tools/test/devfs_test.dart
index c834d02..d3c72bc 100644
--- a/packages/flutter_tools/test/devfs_test.dart
+++ b/packages/flutter_tools/test/devfs_test.dart
@@ -424,14 +424,14 @@
}
class MockVMService extends BasicMock implements VMService {
- Uri _httpAddress;
- HttpServer _server;
- MockVM _vm;
-
MockVMService() {
_vm = MockVM(this);
}
+ Uri _httpAddress;
+ HttpServer _server;
+ MockVM _vm;
+
@override
Uri get httpAddress => _httpAddress;
@@ -468,14 +468,14 @@
}
class MockVM implements VM {
+ MockVM(this._service);
+
final MockVMService _service;
final Uri _baseUri = Uri.parse('file:///tmp/devfs/test');
bool _devFSExists = false;
static const int kFileSystemAlreadyExists = 1001;
- MockVM(this._service);
-
@override
Future<Map<String, dynamic>> createDevFS(String fsName) async {
_service.messages.add('create $fsName');
diff --git a/packages/flutter_tools/test/device_test.dart b/packages/flutter_tools/test/device_test.dart
index 286ee49..db32c3d 100644
--- a/packages/flutter_tools/test/device_test.dart
+++ b/packages/flutter_tools/test/device_test.dart
@@ -39,10 +39,10 @@
}
class TestDeviceManager extends DeviceManager {
- final List<Device> allDevices;
-
TestDeviceManager(this.allDevices);
+ final List<Device> allDevices;
+
@override
Stream<Device> getAllConnectedDevices() {
return Stream<Device>.fromIterable(allDevices);
@@ -50,11 +50,11 @@
}
class _MockDevice extends Device {
+ _MockDevice(this.name, String id) : super(id);
+
@override
final String name;
- _MockDevice(this.name, String id) : super(id);
-
@override
void noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
diff --git a/packages/flutter_tools/test/emulator_test.dart b/packages/flutter_tools/test/emulator_test.dart
index 01c7d4c..0bb1499 100644
--- a/packages/flutter_tools/test/emulator_test.dart
+++ b/packages/flutter_tools/test/emulator_test.dart
@@ -152,10 +152,10 @@
}
class TestEmulatorManager extends EmulatorManager {
- final List<Emulator> allEmulators;
-
TestEmulatorManager(this.allEmulators);
+ final List<Emulator> allEmulators;
+
@override
Future<List<Emulator>> getAllAvailableEmulators() {
return Future<List<Emulator>>.value(allEmulators);
diff --git a/packages/flutter_tools/test/hot_test.dart b/packages/flutter_tools/test/hot_test.dart
index 9d92cd2..0094422 100644
--- a/packages/flutter_tools/test/hot_test.dart
+++ b/packages/flutter_tools/test/hot_test.dart
@@ -135,10 +135,10 @@
}
class TestHotRunnerConfig extends HotRunnerConfig {
- bool successfulSetup;
-
TestHotRunnerConfig({@required this.successfulSetup});
+ bool successfulSetup;
+
@override
Future<bool> setupHotRestart() async {
return successfulSetup;
diff --git a/packages/flutter_tools/test/protocol_discovery_test.dart b/packages/flutter_tools/test/protocol_discovery_test.dart
index 0bd6606..d8499f2 100644
--- a/packages/flutter_tools/test/protocol_discovery_test.dart
+++ b/packages/flutter_tools/test/protocol_discovery_test.dart
@@ -223,9 +223,10 @@
}
class MockPortForwarder extends DevicePortForwarder {
- final int availablePort;
MockPortForwarder([this.availablePort]);
+ final int availablePort;
+
@override
Future<int> forward(int devicePort, {int hostPort}) async {
hostPort ??= 0;
diff --git a/packages/flutter_tools/test/src/mocks.dart b/packages/flutter_tools/test/src/mocks.dart
index 5bcb4bc..eec77f1 100644
--- a/packages/flutter_tools/test/src/mocks.dart
+++ b/packages/flutter_tools/test/src/mocks.dart
@@ -308,12 +308,12 @@
}
class MockPollingDeviceDiscovery extends PollingDeviceDiscovery {
+ MockPollingDeviceDiscovery() : super('mock');
+
final List<Device> _devices = <Device>[];
final StreamController<Device> _onAddedController = StreamController<Device>.broadcast();
final StreamController<Device> _onRemovedController = StreamController<Device>.broadcast();
- MockPollingDeviceDiscovery() : super('mock');
-
@override
Future<List<Device>> pollingGetDevices() async => _devices;