From efb45ea7881891b895a5a3538be24de7f25f42c3 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Wed, 27 Sep 2017 16:13:48 -0700 Subject: [PATCH] Trivial nit fixes (#12285) --- dev/devicelab/lib/framework/adb.dart | 2 +- .../lib/tasks/save_catalog_screenshots.dart | 2 +- dev/manual_tests/lib/card_collection.dart | 2 +- .../lib/demo/material/grid_list_demo.dart | 2 +- .../lib/demo/material/leave_behind_demo.dart | 2 +- .../demo/material/scrollable_tabs_demo.dart | 2 +- .../lib/gallery/syntax_highlighter.dart | 4 +- .../test_driver/transitions_perf_test.dart | 2 +- examples/layers/services/isolate.dart | 2 +- .../test_driver/button_tap_test.dart | 2 +- examples/stocks/lib/stock_home.dart | 2 +- .../lib/src/foundation/diagnostics.dart | 14 +++---- packages/flutter/lib/src/gestures/scale.dart | 2 +- .../flutter/lib/src/material/date_picker.dart | 2 +- .../lib/src/material/expansion_tile.dart | 2 +- .../flutter/lib/src/material/ink_well.dart | 2 +- .../src/material/material_localizations.dart | 2 +- packages/flutter/lib/src/material/tabs.dart | 2 +- .../flutter/lib/src/material/theme_data.dart | 2 +- .../flutter/lib/src/material/time_picker.dart | 2 +- .../lib/src/material/two_level_list.dart | 2 +- .../flutter/lib/src/rendering/object.dart | 20 ++++----- .../flutter/lib/src/rendering/semantics.dart | 2 +- .../rendering/sliver_persistent_header.dart | 2 +- packages/flutter/lib/src/widgets/app.dart | 2 +- .../flutter/lib/src/widgets/dismissible.dart | 4 +- .../lib/src/widgets/fade_in_image.dart | 2 +- .../lib/src/widgets/gesture_detector.dart | 2 +- .../lib/src/widgets/localizations.dart | 2 +- .../flutter/test/material/dropdown_test.dart | 4 +- .../test/material/expansion_panel_test.dart | 4 +- .../flutter/test/material/switch_test.dart | 42 ++++++++++--------- .../flutter/test/material/theme_test.dart | 2 +- packages/flutter_driver/lib/src/driver.dart | 4 +- packages/flutter_driver/lib/src/find.dart | 4 +- .../lib/src/timeline_summary.dart | 2 +- packages/flutter_test/lib/src/matchers.dart | 4 +- .../flutter_tools/lib/src/base/terminal.dart | 6 +-- .../lib/src/commands/analyze_base.dart | 4 +- .../lib/src/commands/create.dart | 2 +- packages/flutter_tools/lib/src/compile.dart | 2 +- packages/flutter_tools/lib/src/devfs.dart | 4 +- .../flutter_tools/lib/src/ios/simulators.dart | 4 +- packages/flutter_tools/lib/src/version.dart | 2 +- 44 files changed, 90 insertions(+), 92 deletions(-) diff --git a/dev/devicelab/lib/framework/adb.dart b/dev/devicelab/lib/framework/adb.dart index 7e293810841..c0e4fe1ebb3 100644 --- a/dev/devicelab/lib/framework/adb.dart +++ b/dev/devicelab/lib/framework/adb.dart @@ -23,7 +23,7 @@ DeviceOperatingSystem deviceOperatingSystem = DeviceOperatingSystem.android; /// Discovers available devices and chooses one to work with. abstract class DeviceDiscovery { factory DeviceDiscovery() { - switch(deviceOperatingSystem) { + switch (deviceOperatingSystem) { case DeviceOperatingSystem.android: return new AndroidDeviceDiscovery(); case DeviceOperatingSystem.ios: diff --git a/dev/devicelab/lib/tasks/save_catalog_screenshots.dart b/dev/devicelab/lib/tasks/save_catalog_screenshots.dart index f2646de0d71..bee740a5c12 100644 --- a/dev/devicelab/lib/tasks/save_catalog_screenshots.dart +++ b/dev/devicelab/lib/tasks/save_catalog_screenshots.dart @@ -101,7 +101,7 @@ Future saveScreenshots(List fromPaths, List largeNames, Li for (int index = 0; index < uploads.length; index += 1) uploads[index] = new Upload(fromPaths[index], largeNames[index], smallNames[index]); - while(uploads.any(Upload.isNotComplete)) { + while (uploads.any(Upload.isNotComplete)) { final HttpClient client = new HttpClient(); uploads = uploads.where(Upload.isNotComplete).toList(); await Future.wait(uploads.map((Upload upload) => upload.run(client))); diff --git a/dev/manual_tests/lib/card_collection.dart b/dev/manual_tests/lib/card_collection.dart index 7d9636108ef..e79acd62b49 100644 --- a/dev/manual_tests/lib/card_collection.dart +++ b/dev/manual_tests/lib/card_collection.dart @@ -265,7 +265,7 @@ class CardCollectionState extends State { ); String backgroundMessage; - switch(_dismissDirection) { + switch (_dismissDirection) { case DismissDirection.horizontal: backgroundMessage = "Swipe in either direction"; break; diff --git a/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart b/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart index ef1488840d3..10b6f845293 100644 --- a/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/grid_list_demo.dart @@ -199,7 +199,7 @@ class GridDemoPhotoItem extends StatelessWidget { final IconData icon = photo.isFavorite ? Icons.star : Icons.star_border; - switch(tileStyle) { + switch (tileStyle) { case GridDemoTileStyle.imageOnly: return image; diff --git a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart index 220d6a4a531..b44312d4c65 100644 --- a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart @@ -60,7 +60,7 @@ class LeaveBehindDemoState extends State { } void handleDemoAction(LeaveBehindDemoAction action) { - switch(action) { + switch (action) { case LeaveBehindDemoAction.reset: initListItems(); break; diff --git a/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart b/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart index 0d02fab0e0a..dc741b6b7a6 100644 --- a/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart @@ -83,7 +83,7 @@ class ScrollableTabsDemoState extends State with SingleTicke controller: _controller, isScrollable: true, tabs: _allPages.map((_Page page) { - switch(_demoStyle) { + switch (_demoStyle) { case TabsDemoStyle.iconsAndText: return new Tab(text: page.text, icon: new Icon(page.icon)); case TabsDemoStyle.iconsOnly: diff --git a/examples/flutter_gallery/lib/gallery/syntax_highlighter.dart b/examples/flutter_gallery/lib/gallery/syntax_highlighter.dart index 51319eaf967..eb6a1ad7306 100644 --- a/examples/flutter_gallery/lib/gallery/syntax_highlighter.dart +++ b/examples/flutter_gallery/lib/gallery/syntax_highlighter.dart @@ -116,7 +116,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter { bool _generateSpans() { int lastLoopPosition = _scanner.position; - while(!_scanner.isDone) { + while (!_scanner.isDone) { // Skip White space _scanner.scan(new RegExp(r"\s+")); @@ -294,7 +294,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter { } void _simplify() { - for(int i = _spans.length - 2; i >= 0; i -= 1) { + for (int i = _spans.length - 2; i >= 0; i -= 1) { if (_spans[i].type == _spans[i + 1].type && _spans[i].end == _spans[i + 1].start) { _spans[i] = new _HighlightSpan( _spans[i].type, diff --git a/examples/flutter_gallery/test_driver/transitions_perf_test.dart b/examples/flutter_gallery/test_driver/transitions_perf_test.dart index e2017d45b3b..d1dd562d6aa 100644 --- a/examples/flutter_gallery/test_driver/transitions_perf_test.dart +++ b/examples/flutter_gallery/test_driver/transitions_perf_test.dart @@ -121,7 +121,7 @@ Future saveDurationsHistogram(List> events, String ou final Iterator> eventIter = events.iterator; String lastEventName = ''; String lastRouteName = ''; - while(eventIter.moveNext()) { + while (eventIter.moveNext()) { final String eventName = eventIter.current['name']; if (!['Start Transition', 'Frame'].contains(eventName)) diff --git a/examples/layers/services/isolate.dart b/examples/layers/services/isolate.dart index 395875780fa..e8ce214b03f 100644 --- a/examples/layers/services/isolate.dart +++ b/examples/layers/services/isolate.dart @@ -282,7 +282,7 @@ class IsolateExampleState extends State with SingleTickerProvide } String _getStatus(CalculationState state) { - switch(state) { + switch (state) { case CalculationState.loading: return 'Loading...'; case CalculationState.calculating: diff --git a/examples/platform_channel_swift/test_driver/button_tap_test.dart b/examples/platform_channel_swift/test_driver/button_tap_test.dart index cf6601ead11..c372dc5309a 100644 --- a/examples/platform_channel_swift/test_driver/button_tap_test.dart +++ b/examples/platform_channel_swift/test_driver/button_tap_test.dart @@ -27,7 +27,7 @@ void main() { await driver.tap(button); String batteryLevel; - while(batteryLevel == null || batteryLevel.isEmpty) { + while (batteryLevel == null || batteryLevel.isEmpty) { batteryLevel = await driver.getText(batteryLevelLabel); } expect(batteryLevel, isNotEmpty); diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart index 0f18d3b58e7..3446bda1405 100644 --- a/examples/stocks/lib/stock_home.dart +++ b/examples/stocks/lib/stock_home.dart @@ -86,7 +86,7 @@ class StockHomeState extends State { } void _handleStockMenu(BuildContext context, _StockMenuItem value) { - switch(value) { + switch (value) { case _StockMenuItem.autorefresh: setState(() { _autorefresh = !_autorefresh; diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index 1ac914063ca..4661ecd2c3d 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -1386,7 +1386,7 @@ class IterableProperty extends DiagnosticsProperty> { /// Create a diagnostics property for iterables (e.g. lists). /// /// The [ifEmpty] argument is used to indicate how an iterable [value] with 0 - /// elements is displayed. If [ifEmpty] equals `null` that indicates that an + /// elements is displayed. If [ifEmpty] equals null that indicates that an /// empty iterable [value] is not interesting to display similar to how /// [defaultValue] is used to indicate that a specific concrete value is not /// interesting to display. @@ -1433,10 +1433,10 @@ class IterableProperty extends DiagnosticsProperty> { /// Priority level of the diagnostic used to control which diagnostics should /// be shown and filtered. /// - /// If [ifEmpty] is `null` and the [value] is an empty [Iterable] then level + /// If [ifEmpty] is null and the [value] is an empty [Iterable] then level /// [DiagnosticLevel.fine] is returned in a similar way to how an - /// [ObjectFlagProperty] handles when [ifNull] is `null` and the [value] is - /// `null`. + /// [ObjectFlagProperty] handles when [ifNull] is null and the [value] is + /// null. @override DiagnosticLevel get level { if (ifEmpty == null && value != null && value.isEmpty && super.level != DiagnosticLevel.hidden) @@ -1605,8 +1605,8 @@ class DiagnosticsProperty extends DiagnosticsNode { /// /// The [level] argument is just a suggestion and can be overridden if /// something else about the property causes it to have a lower or higher - /// level. For example, if the property value is `null` and [missingIfNull] is - /// `true`, [level] is raised to [DiagnosticLevel.warning]. + /// level. For example, if the property value is null and [missingIfNull] is + /// true, [level] is raised to [DiagnosticLevel.warning]. DiagnosticsProperty( String name, T value, { @@ -2056,7 +2056,7 @@ abstract class Diagnosticable { /// Returns a debug representation of the object that is used by debugging /// tools and by [toStringDeep]. /// - /// Leave [name] as `null` if there is not a meaningful description of the + /// Leave [name] as null if there is not a meaningful description of the /// relationship between the this node and its parent. /// /// Typically the [style] argument is only specified to indicate an atypical diff --git a/packages/flutter/lib/src/gestures/scale.dart b/packages/flutter/lib/src/gestures/scale.dart index 2f5f423d263..0f5fa85b445 100644 --- a/packages/flutter/lib/src/gestures/scale.dart +++ b/packages/flutter/lib/src/gestures/scale.dart @@ -254,7 +254,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { @override void didStopTrackingLastPointer(int pointer) { - switch(_state) { + switch (_state) { case _ScaleState.possible: resolve(GestureDisposition.rejected); break; diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart index b4a24564b50..f4e3f8534a9 100644 --- a/packages/flutter/lib/src/material/date_picker.dart +++ b/packages/flutter/lib/src/material/date_picker.dart @@ -87,7 +87,7 @@ class _DatePickerHeader extends StatelessWidget { final TextTheme headerTextTheme = themeData.primaryTextTheme; Color dayColor; Color yearColor; - switch(themeData.primaryColorBrightness) { + switch (themeData.primaryColorBrightness) { case Brightness.light: dayColor = mode == DatePickerMode.day ? Colors.black87 : Colors.black54; yearColor = mode == DatePickerMode.year ? Colors.black87 : Colors.black54; diff --git a/packages/flutter/lib/src/material/expansion_tile.dart b/packages/flutter/lib/src/material/expansion_tile.dart index a32656914d9..d21a0f79c6c 100644 --- a/packages/flutter/lib/src/material/expansion_tile.dart +++ b/packages/flutter/lib/src/material/expansion_tile.dart @@ -54,7 +54,7 @@ class ExpansionTile extends StatefulWidget { /// Called when the tile expands or collapses. /// /// When the tile starts expanding, this function is called with the value - /// `true`. When the tile starts collapsing, this function is called with + /// true. When the tile starts collapsing, this function is called with /// the value false. final ValueChanged onExpansionChanged; diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart index 71d3ff218a7..dbd8f0b54fe 100644 --- a/packages/flutter/lib/src/material/ink_well.dart +++ b/packages/flutter/lib/src/material/ink_well.dart @@ -71,7 +71,7 @@ import 'theme.dart'; /// ```dart /// assert(debugCheckHasMaterial(context)); /// ``` -/// The parameter [enableFeedback] must not be `null`. +/// The parameter [enableFeedback] must not be null. /// /// See also: /// diff --git a/packages/flutter/lib/src/material/material_localizations.dart b/packages/flutter/lib/src/material/material_localizations.dart index 046fa2084fa..e2781eb016c 100644 --- a/packages/flutter/lib/src/material/material_localizations.dart +++ b/packages/flutter/lib/src/material/material_localizations.dart @@ -102,7 +102,7 @@ abstract class MaterialLocalizations { /// This text theme is incomplete. For example, it lacks text color /// information. This theme must be merged with another text theme that /// provides the missing values. The text styles provided by this theme have - /// their [TextStyle.inherit] property set to `true`. + /// their [TextStyle.inherit] property set to true. /// /// Typically a complete theme is obtained via [Theme.of], which can be /// localized using the [Localizations] widget. diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 28053082f16..4cc8c2cf7fa 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -303,7 +303,7 @@ class _IndicatorPainter extends CustomPainter { static bool _tabOffsetsNotEqual(List a, List b) { assert(a != null && b != null && a.length == b.length); - for(int i = 0; i < a.length; i++) { + for (int i = 0; i < a.length; i += 1) { if (a[i] != b[i]) return true; } diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 8ef8bcb6647..34280c05c03 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -457,7 +457,7 @@ class ThemeData { /// provided by the [localTextGeometry]. /// /// The [TextStyle.inherit] field in the text styles provided by - /// [localTextGeometry] must be set to `true`. + /// [localTextGeometry] must be set to true. static ThemeData localize(ThemeData baseTheme, TextTheme localTextGeometry) { assert(baseTheme != null); assert(localTextGeometry != null); diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart index 959f30ba794..ebebe37ebf4 100644 --- a/packages/flutter/lib/src/material/time_picker.dart +++ b/packages/flutter/lib/src/material/time_picker.dart @@ -287,7 +287,7 @@ class _MinuteControl extends StatelessWidget { /// Provides time picker header layout configuration for the given /// [timeOfDayFormat] passing [context] to each widget in the configuration. /// -/// [timeOfDayFormat] and [context] must not be `null`. +/// The [timeOfDayFormat] and [context] arguments must not be null. _TimePickerHeaderFormat _buildHeaderFormat(TimeOfDayFormat timeOfDayFormat, _TimePickerFragmentContext context) { // Creates an hour fragment. _TimePickerHeaderFragment hour(HourFormat hourFormat) { diff --git a/packages/flutter/lib/src/material/two_level_list.dart b/packages/flutter/lib/src/material/two_level_list.dart index 3760552e0b6..b3661e06872 100644 --- a/packages/flutter/lib/src/material/two_level_list.dart +++ b/packages/flutter/lib/src/material/two_level_list.dart @@ -130,7 +130,7 @@ class TwoLevelSublist extends StatefulWidget { /// Called when the sublist expands or collapses. /// /// When the sublist starts expanding, this function is called with the value - /// `true`. When the sublist starts collapsing, this function is called with + /// true. When the sublist starts collapsing, this function is called with /// the value false. final ValueChanged onOpenChanged; diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index 5d63678a684..931e6fcf932 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -778,7 +778,7 @@ class _RootSemanticsFragment extends _InterestingSemanticsFragment { } } -/// Represents a RenderObject that has [isSemanticBoundary] set to `true`. +/// Represents a RenderObject that has [isSemanticBoundary] set to true. /// /// It returns the SemanticsNode for that [RenderObject]. class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment { @@ -818,7 +818,7 @@ class _ConcreteSemanticsFragment extends _InterestingSemanticsFragment { } /// Represents a RenderObject that does not have [isSemanticBoundary] set to -/// `true`, but which does have some semantic annotators. +/// true, but which does have some semantic annotators. /// /// When it is compiled, if the nearest ancestor [_SemanticsFragment] that isn't /// also an [_ImplicitSemanticsFragment] is a [_RootSemanticsFragment] or a @@ -2500,7 +2500,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im /// Whether this [RenderObject] makes other [RenderObject]s previously painted /// within the same semantic boundary unreachable for accessibility purposes. /// - /// If `true` is returned, the [SemanticsNode]s for all siblings and cousins + /// If true is returned, the [SemanticsNode]s for all siblings and cousins /// of this node, that are earlier in a depth-first pre-order traversal, are /// dropped from the semantics tree up until a semantic boundary (as defined /// by [isSemanticBoundary]) is reached. @@ -2562,9 +2562,9 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im /// /// The parameters [onlyLocalUpdates] and [noGeometry] tell the framework /// how much of the semantics have changed. Bigger changes (indicated by - /// setting one or both parameters to `false`) are more expansive to compute. + /// setting one or both parameters to false) are more expansive to compute. /// - /// [onlyLocalUpdates] should be set to `true` to reduce cost if the semantics + /// [onlyLocalUpdates] should be set to true to reduce cost if the semantics /// update does not in any way change the shape of the semantics tree (e.g. /// [SemanticsNode]s will neither be added/removed from the tree nor be moved /// within the tree). In other words, with [onlyLocalChanges] the @@ -2572,14 +2572,14 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im /// local [SemanticsNode] (e.g. changing a label or flag) without affecting /// other nodes in the tree. /// - /// [onlyLocalUpdates] has to be set to `false` in the following cases as they + /// [onlyLocalUpdates] has to be set to false in the following cases as they /// will change the shape of the tree: /// /// 1. [isSemanticBoundary] changed its value. - /// 2. [semanticsAnnotator] changed from or to returning `null` and - /// [isSemanticBoundary] isn't `true`. + /// 2. [semanticsAnnotator] changed from or to returning null and + /// [isSemanticBoundary] isn't true. /// - /// [noGeometry] should be set to `true` to reduce cost if the geometry (e.g. + /// [noGeometry] should be set to true to reduce cost if the geometry (e.g. /// size and position) of the corresponding [SemanticsNode] has not /// changed. Examples for such semantic updates that don't require a geometry /// update are changes to flags, labels, or actions. @@ -2766,7 +2766,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im /// [markNeedsSemanticsUpdate] must not have `onlyLocalUpdates` set, as it is /// possible that the node should be entirely removed. /// - /// If the annotation should only happen under certain conditions, `null` + /// If the annotation should only happen under certain conditions, null /// should be returned if those conditions are currently not met to avoid /// the creation of an empty [SemanticsNode]. SemanticsAnnotator get semanticsAnnotator => null; diff --git a/packages/flutter/lib/src/rendering/semantics.dart b/packages/flutter/lib/src/rendering/semantics.dart index 89f2270070a..3819d257386 100644 --- a/packages/flutter/lib/src/rendering/semantics.dart +++ b/packages/flutter/lib/src/rendering/semantics.dart @@ -830,7 +830,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { if (_children == null) return const []; - switch(childOrder) { + switch (childOrder) { case DebugSemanticsDumpOrder.traversal: return new List.from(_children)..sort(_geometryComparator); case DebugSemanticsDumpOrder.inverseHitTest: diff --git a/packages/flutter/lib/src/rendering/sliver_persistent_header.dart b/packages/flutter/lib/src/rendering/sliver_persistent_header.dart index 0879ac067bd..2ff0cb2c4c3 100644 --- a/packages/flutter/lib/src/rendering/sliver_persistent_header.dart +++ b/packages/flutter/lib/src/rendering/sliver_persistent_header.dart @@ -209,7 +209,7 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje /// be excluded from the semantic scrolling area. /// /// [RenderSliver]s that stay on the screen even though the user has scrolled - /// past them (e.g. a pinned app bar) should set this to `true`. + /// past them (e.g. a pinned app bar) should set this to true. @protected bool get excludeFromSemanticsScrolling => _excludeFromSemanticsScrolling; bool _excludeFromSemanticsScrolling = false; diff --git a/packages/flutter/lib/src/widgets/app.dart b/packages/flutter/lib/src/widgets/app.dart index 9e9e9a9674f..b97ff6ea741 100644 --- a/packages/flutter/lib/src/widgets/app.dart +++ b/packages/flutter/lib/src/widgets/app.dart @@ -330,7 +330,7 @@ class _WidgetsAppState extends State implements WidgetsBindingObserv // Android devices (Java really) report 3 deprecated language codes, see // http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4140555 // and https://developer.android.com/reference/java/util/Locale.html - switch(newLocale.languageCode) { + switch (newLocale.languageCode) { case 'iw': newLocale = new Locale('he', newLocale.countryCode); // Hebrew break; diff --git a/packages/flutter/lib/src/widgets/dismissible.dart b/packages/flutter/lib/src/widgets/dismissible.dart index 2e14ad1867a..fecd84a1cf6 100644 --- a/packages/flutter/lib/src/widgets/dismissible.dart +++ b/packages/flutter/lib/src/widgets/dismissible.dart @@ -285,7 +285,7 @@ class _DismissibleState extends State with TickerProviderStateMixin if (_directionIsXAxis) { if (vx.abs() - vy.abs() < _kMinFlingVelocityDelta) return false; - switch(widget.direction) { + switch (widget.direction) { case DismissDirection.horizontal: return vx.abs() > _kMinFlingVelocity; case DismissDirection.endToStart: @@ -296,7 +296,7 @@ class _DismissibleState extends State with TickerProviderStateMixin } else { if (vy.abs() - vx.abs() < _kMinFlingVelocityDelta) return false; - switch(widget.direction) { + switch (widget.direction) { case DismissDirection.vertical: return vy.abs() > _kMinFlingVelocity; case DismissDirection.up: diff --git a/packages/flutter/lib/src/widgets/fade_in_image.dart b/packages/flutter/lib/src/widgets/fade_in_image.dart index aded85759c0..552b5aaa3cc 100644 --- a/packages/flutter/lib/src/widgets/fade_in_image.dart +++ b/packages/flutter/lib/src/widgets/fade_in_image.dart @@ -406,7 +406,7 @@ class _FadeInImageState extends State with TickerProviderStateMixin void _updatePhase() { setState(() { - switch(_phase) { + switch (_phase) { case FadeInImagePhase.start: if (_imageResolver._imageInfo != null) _phase = FadeInImagePhase.completed; diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart index 3a467a3758b..527d09cf4a3 100644 --- a/packages/flutter/lib/src/widgets/gesture_detector.dart +++ b/packages/flutter/lib/src/widgets/gesture_detector.dart @@ -567,7 +567,7 @@ class RawGestureDetectorState extends State { /// The event can be interpreted by assistive technologies to provide /// additional feedback to the user about the state of the UI. /// - /// The event will not be sent if [excludeFromSemantics] is set to `true`. + /// The event will not be sent if [excludeFromSemantics] is set to true. void sendSemanticsEvent(SemanticsEvent event) { if (!widget.excludeFromSemantics) { final RenderSemanticsGestureHandler semanticsGestureHandler = context.findRenderObject(); diff --git a/packages/flutter/lib/src/widgets/localizations.dart b/packages/flutter/lib/src/widgets/localizations.dart index 0ca84de1a4f..d238c4e39f5 100644 --- a/packages/flutter/lib/src/widgets/localizations.dart +++ b/packages/flutter/lib/src/widgets/localizations.dart @@ -411,7 +411,7 @@ class Localizations extends StatefulWidget { /// Returns the localized resources object of the given `type` for the widget /// tree that corresponds to the given `context`. /// - /// Returns `null` if no resources object of the given `type` exists within + /// Returns null if no resources object of the given `type` exists within /// the given `context`. /// /// This method is typically used by a static factory method on the `type` diff --git a/packages/flutter/test/material/dropdown_test.dart b/packages/flutter/test/material/dropdown_test.dart index 47af0ee5f60..863d90fabea 100644 --- a/packages/flutter/test/material/dropdown_test.dart +++ b/packages/flutter/test/material/dropdown_test.dart @@ -274,7 +274,7 @@ void main() { // have the same origin and height as the dropdown button. final List itemBoxes = tester.renderObjectList(find.byKey(const ValueKey('two'))).toList(); expect(itemBoxes.length, equals(2)); - for(RenderBox itemBox in itemBoxes) { + for (RenderBox itemBox in itemBoxes) { assert(itemBox.attached); expect(buttonBox.localToGlobal(Offset.zero), equals(itemBox.localToGlobal(Offset.zero))); expect(buttonBox.size.height, equals(itemBox.size.height)); @@ -310,7 +310,7 @@ void main() { final double menuItemHeight = itemBoxes.map((RenderBox box) => box.size.height).reduce(math.max); expect(menuItemHeight, greaterThan(buttonBox.size.height)); - for(RenderBox itemBox in itemBoxes) { + for (RenderBox itemBox in itemBoxes) { assert(itemBox.attached); final Offset buttonBoxCenter = buttonBox.size.center(buttonBox.localToGlobal(Offset.zero)); final Offset itemBoxCenter = itemBox.size.center(itemBox.localToGlobal(Offset.zero)); diff --git a/packages/flutter/test/material/expansion_panel_test.dart b/packages/flutter/test/material/expansion_panel_test.dart index 191763d5dc8..1f04ea4c4a3 100644 --- a/packages/flutter/test/material/expansion_panel_test.dart +++ b/packages/flutter/test/material/expansion_panel_test.dart @@ -82,7 +82,7 @@ void main() { headerBuilder: (BuildContext context, bool isExpanded) { return new Text(isExpanded ? 'B' : 'A'); }, - body: const SizedBox(height:100.0), + body: const SizedBox(height: 100.0), isExpanded: true, ), ], @@ -93,7 +93,7 @@ void main() { headerBuilder: (BuildContext context, bool isExpanded){ return new Text(isExpanded ? 'D' : 'C'); }, - body: const SizedBox(height:100.0), + body: const SizedBox(height: 100.0), isExpanded: true, ), ], diff --git a/packages/flutter/test/material/switch_test.dart b/packages/flutter/test/material/switch_test.dart index 78c41bfa13e..8238f6dc0cd 100644 --- a/packages/flutter/test/material/switch_test.dart +++ b/packages/flutter/test/material/switch_test.dart @@ -160,29 +160,31 @@ void main() { ); expect( - Material.of(tester.element(find.byType(Switch))), - paints - ..rrect( - color: Colors.blue[500], - rrect: new RRect.fromLTRBR( - 383.5, 293.0, 416.5, 307.0, const Radius.circular(7.0))) - ..circle(color: const Color(0x33000000)) - ..circle(color: const Color(0x24000000)) - ..circle(color: const Color(0x1f000000)) - ..circle(color: Colors.yellow[500])); + Material.of(tester.element(find.byType(Switch))), + paints + ..rrect( + color: Colors.blue[500], + rrect: new RRect.fromLTRBR( + 383.5, 293.0, 416.5, 307.0, const Radius.circular(7.0))) + ..circle(color: const Color(0x33000000)) + ..circle(color: const Color(0x24000000)) + ..circle(color: const Color(0x1f000000)) + ..circle(color: Colors.yellow[500]) + ); await tester.drag(find.byType(Switch), const Offset(-30.0, 0.0)); await tester.pump(); expect( - Material.of(tester.element(find.byType(Switch))), - paints - ..rrect( - color: Colors.green[500], - rrect: new RRect.fromLTRBR( - 383.5, 293.0, 416.5, 307.0, const Radius.circular(7.0))) - ..circle(color: const Color(0x33000000)) - ..circle(color: const Color(0x24000000)) - ..circle(color: const Color(0x1f000000)) - ..circle(color: Colors.red[500])); + Material.of(tester.element(find.byType(Switch))), + paints + ..rrect( + color: Colors.green[500], + rrect: new RRect.fromLTRBR( + 383.5, 293.0, 416.5, 307.0, const Radius.circular(7.0))) + ..circle(color: const Color(0x33000000)) + ..circle(color: const Color(0x24000000)) + ..circle(color: const Color(0x1f000000)) + ..circle(color: Colors.red[500]) + ); }); } diff --git a/packages/flutter/test/material/theme_test.dart b/packages/flutter/test/material/theme_test.dart index df6ae16d67a..51cedbc1a37 100644 --- a/packages/flutter/test/material/theme_test.dart +++ b/packages/flutter/test/material/theme_test.dart @@ -122,7 +122,7 @@ void main() { await tester.tap(find.byKey(dropdownMenuButtonKey)); await tester.pump(const Duration(seconds: 1)); - for(Element item in tester.elementList(find.text('menuItem'))) + for (Element item in tester.elementList(find.text('menuItem'))) expect(Theme.of(item).brightness, equals(Brightness.light)); }); diff --git a/packages/flutter_driver/lib/src/driver.dart b/packages/flutter_driver/lib/src/driver.dart index 41448bfa874..a9ce328e234 100644 --- a/packages/flutter_driver/lib/src/driver.dart +++ b/packages/flutter_driver/lib/src/driver.dart @@ -75,7 +75,7 @@ final Duration _kPauseBetweenReconnectAttempts = _kShortTimeout ~/ 5; // See https://github.com/dart-lang/sdk/blob/master/runtime/vm/timeline.cc#L32 String _timelineStreamsToString(List streams) { final String contents = streams.map((TimelineStream stream) { - switch(stream) { + switch (stream) { case TimelineStream.all: return 'all'; case TimelineStream.api: return 'API'; case TimelineStream.compiler: return 'Compiler'; @@ -425,7 +425,7 @@ class FlutterDriver { /// Turns semantics on or off in the Flutter app under test. /// - /// Returns `true` when the call actually changed the state from on to off or + /// Returns true when the call actually changed the state from on to off or /// vice versa. Future setSemantics(bool enabled, { Duration timeout: _kShortTimeout }) async { final SetSemanticsResult result = SetSemanticsResult.fromJson(await _sendCommand(new SetSemantics(enabled, timeout: timeout))); diff --git a/packages/flutter_driver/lib/src/find.dart b/packages/flutter_driver/lib/src/find.dart index a5c831ace0a..d5541ad075f 100644 --- a/packages/flutter_driver/lib/src/find.dart +++ b/packages/flutter_driver/lib/src/find.dart @@ -131,7 +131,7 @@ abstract class SerializableFinder { /// Deserializes a finder from JSON generated by [serialize]. static SerializableFinder deserialize(Map json) { final String finderType = json['finderType']; - switch(finderType) { + switch (finderType) { case 'ByType': return ByType.deserialize(json); case 'ByValueKey': return ByValueKey.deserialize(json); case 'ByTooltipMessage': return ByTooltipMessage.deserialize(json); @@ -219,7 +219,7 @@ class ByValueKey extends SerializableFinder { static ByValueKey deserialize(Map json) { final String keyValueString = json['keyValueString']; final String keyValueType = json['keyValueType']; - switch(keyValueType) { + switch (keyValueType) { case 'int': return new ByValueKey(int.parse(keyValueString)); case 'String': diff --git a/packages/flutter_driver/lib/src/timeline_summary.dart b/packages/flutter_driver/lib/src/timeline_summary.dart index 099d0c8ba97..bc1e3c62ba5 100644 --- a/packages/flutter_driver/lib/src/timeline_summary.dart +++ b/packages/flutter_driver/lib/src/timeline_summary.dart @@ -138,7 +138,7 @@ class TimelineSummary { // Timeline does not guarantee that the first event is the "begin" event. final Iterator events = _extractNamedEvents(name) .skipWhile((TimelineEvent evt) => evt.phase != 'B').iterator; - while(events.moveNext()) { + while (events.moveNext()) { final TimelineEvent beginEvent = events.current; if (events.moveNext()) { final TimelineEvent endEvent = events.current; diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index e5c07929866..5ac536939b9 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart @@ -434,10 +434,10 @@ class _EqualsIgnoringHashCodes extends Matcher { } } -/// Returns `true` if [c] represents a whitespace code unit. +/// Returns true if [c] represents a whitespace code unit. bool _isWhitespace(int c) => (c <= 0x000D && c >= 0x0009) || c == 0x0020; -/// Returns `true` if [c] represents a vertical line unicode line art code unit. +/// Returns true if [c] represents a vertical line unicode line art code unit. /// /// See [https://en.wikipedia.org/wiki/Box-drawing_character]. This method only /// specifies vertical line art code units currently used by Flutter line art. diff --git a/packages/flutter_tools/lib/src/base/terminal.dart b/packages/flutter_tools/lib/src/base/terminal.dart index aace3b00931..3ec32e9fdb5 100644 --- a/packages/flutter_tools/lib/src/base/terminal.dart +++ b/packages/flutter_tools/lib/src/base/terminal.dart @@ -118,11 +118,7 @@ class AnsiTerminal { } String choice; singleCharMode = true; - while( - isEmpty(choice) - || choice.length != 1 - || !acceptedCharacters.contains(choice) - ) { + while (isEmpty(choice) || choice.length != 1 || !acceptedCharacters.contains(choice)) { if (isNotEmpty(prompt)) { printStatus(prompt, emphasis: true, newline: false); if (displayAcceptedCharacters) diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart index fc8c8b5c4de..daebe970ad2 100644 --- a/packages/flutter_tools/lib/src/commands/analyze_base.dart +++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart @@ -53,8 +53,8 @@ abstract class AnalyzeBase { bool get isBenchmarking => argResults['benchmark']; } -/// Return `true` if [fileList] contains a path that resides inside the Flutter repository. -/// If [fileList] is empty, then return `true` if the current directory resides inside the Flutter repository. +/// Return true if [fileList] contains a path that resides inside the Flutter repository. +/// If [fileList] is empty, then return true if the current directory resides inside the Flutter repository. bool inRepo(List fileList) { if (fileList == null || fileList.isEmpty) fileList = [fs.path.current]; diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart index 6e31fa93b69..432b9715b17 100644 --- a/packages/flutter_tools/lib/src/commands/create.dart +++ b/packages/flutter_tools/lib/src/commands/create.dart @@ -383,7 +383,7 @@ String _validateProjectDir(String dirPath, { String flutterRoot }) { final FileSystemEntityType type = fs.typeSync(dirPath); if (type != FileSystemEntityType.NOT_FOUND) { - switch(type) { + switch (type) { case FileSystemEntityType.FILE: // Do not overwrite files. return "Invalid project name: '$dirPath' - file exists."; diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index 10528050af7..961c5a6afae 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -109,7 +109,7 @@ class ResidentCompiler { /// Otherwise, [mainPath] is ignored, but [invalidatedFiles] is recompiled /// into new binary. /// Binary file name is returned if compilation was successful, otherwise - /// `null` is returned. + /// null is returned. Future recompile(String mainPath, List invalidatedFiles) async { stdoutHandler.reset(); diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index 938d5deffc7..65a5b710bc2 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -30,7 +30,7 @@ DevFSConfig get devFSConfig => context[DevFSConfig]; abstract class DevFSContent { bool _exists = true; - /// Return `true` if this is the first time this method is called + /// Return true if this is the first time this method is called /// or if the entry has been modified since this method was last called. bool get isModified; @@ -125,7 +125,7 @@ class DevFSByteContent extends DevFSContent { _isModified = true; } - /// Return `true` only once so that the content is written to the device only once. + /// Return true only once so that the content is written to the device only once. @override bool get isModified { final bool modified = _isModified; diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart index 75b5ccb7a57..3376d7542f7 100644 --- a/packages/flutter_tools/lib/src/ios/simulators.dart +++ b/packages/flutter_tools/lib/src/ios/simulators.dart @@ -668,12 +668,12 @@ int compareIosVersions(String v1, String v2) { final List v2Fragments = v2.split('.').map(int.parse).toList(); int i = 0; - while(i < v1Fragments.length && i < v2Fragments.length) { + while (i < v1Fragments.length && i < v2Fragments.length) { final int v1Fragment = v1Fragments[i]; final int v2Fragment = v2Fragments[i]; if (v1Fragment != v2Fragment) return v1Fragment.compareTo(v2Fragment); - i++; + i += 1; } return v1Fragments.length.compareTo(v2Fragments.length); } diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart index 9cc6a77846b..8d74a292310 100644 --- a/packages/flutter_tools/lib/src/version.dart +++ b/packages/flutter_tools/lib/src/version.dart @@ -395,7 +395,7 @@ class VersionCheckError implements Exception { /// Runs [command] and returns the standard output as a string. /// -/// If [lenient] is `true` and the command fails, returns an empty string. +/// If [lenient] is true and the command fails, returns an empty string. /// Otherwise, throws a [ToolExit] exception. String _runSync(List command, {bool lenient: true}) { final ProcessResult results = processManager.runSync(command, workingDirectory: Cache.flutterRoot);