Unverified Commit 2e80bf1d authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

unnessary parenthesis (#14475)

parent ede01a77
...@@ -57,7 +57,7 @@ String expandTemplate(String template, Map<String, String> values) { ...@@ -57,7 +57,7 @@ String expandTemplate(String template, Map<String, String> values) {
if (match.groupCount != 1) if (match.groupCount != 1)
throw new SampleError('bad template keyword $match[0]'); throw new SampleError('bad template keyword $match[0]');
final String keyword = match[1]; final String keyword = match[1];
return (values[keyword] ?? ''); return values[keyword] ?? '';
}); });
} }
......
...@@ -326,7 +326,7 @@ class _RecipePageState extends State<RecipePage> { ...@@ -326,7 +326,7 @@ class _RecipePageState extends State<RecipePage> {
// the edge of the screen, use a slightly different layout. // the edge of the screen, use a slightly different layout.
final double appBarHeight = _getAppBarHeight(context); final double appBarHeight = _getAppBarHeight(context);
final Size screenSize = MediaQuery.of(context).size; final Size screenSize = MediaQuery.of(context).size;
final bool fullWidth = (screenSize.width < _kRecipePageMaxWidth); final bool fullWidth = screenSize.width < _kRecipePageMaxWidth;
final bool isFavorite = _favoriteRecipes.contains(widget.recipe); final bool isFavorite = _favoriteRecipes.contains(widget.recipe);
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
......
...@@ -170,7 +170,7 @@ abstract class RenderDecoratedSector extends RenderSector { ...@@ -170,7 +170,7 @@ abstract class RenderDecoratedSector extends RenderSector {
final Canvas canvas = context.canvas; final Canvas canvas = context.canvas;
final Paint paint = new Paint()..color = _decoration.color; final Paint paint = new Paint()..color = _decoration.color;
final Path path = new Path(); final Path path = new Path();
final double outerRadius = (parentData.radius + deltaRadius); final double outerRadius = parentData.radius + deltaRadius;
final Rect outerBounds = new Rect.fromLTRB(offset.dx-outerRadius, offset.dy-outerRadius, offset.dx+outerRadius, offset.dy+outerRadius); final Rect outerBounds = new Rect.fromLTRB(offset.dx-outerRadius, offset.dy-outerRadius, offset.dx+outerRadius, offset.dy+outerRadius);
path.arcTo(outerBounds, parentData.theta, deltaTheta, true); path.arcTo(outerBounds, parentData.theta, deltaTheta, true);
final double innerRadius = parentData.radius; final double innerRadius = parentData.radius;
......
...@@ -27,7 +27,7 @@ class _GesturePainter extends CustomPainter { ...@@ -27,7 +27,7 @@ class _GesturePainter extends CustomPainter {
@override @override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
final Offset center = (size.center(Offset.zero) * zoom + offset); final Offset center = size.center(Offset.zero) * zoom + offset;
final double radius = size.width / 2.0 * zoom; final double radius = size.width / 2.0 * zoom;
final Gradient gradient = new RadialGradient( final Gradient gradient = new RadialGradient(
colors: forward ? <Color>[swatch.shade50, swatch.shade900] colors: forward ? <Color>[swatch.shade50, swatch.shade900]
......
...@@ -196,7 +196,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -196,7 +196,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
invokeCallback<void>('onCancel', onCancel); invokeCallback<void>('onCancel', onCancel);
return; return;
} }
final bool wasAccepted = (_state == _DragState.accepted); final bool wasAccepted = _state == _DragState.accepted;
_state = _DragState.ready; _state = _DragState.ready;
if (wasAccepted && onEnd != null) { if (wasAccepted && onEnd != null) {
final VelocityTracker tracker = _velocityTrackers[pointer]; final VelocityTracker tracker = _velocityTrackers[pointer];
......
...@@ -121,7 +121,7 @@ class InkHighlight extends InteractiveInkFeature { ...@@ -121,7 +121,7 @@ class InkHighlight extends InteractiveInkFeature {
void paintFeature(Canvas canvas, Matrix4 transform) { void paintFeature(Canvas canvas, Matrix4 transform) {
final Paint paint = new Paint()..color = color.withAlpha(_alpha.value); final Paint paint = new Paint()..color = color.withAlpha(_alpha.value);
final Offset originOffset = MatrixUtils.getAsTranslation(transform); final Offset originOffset = MatrixUtils.getAsTranslation(transform);
final Rect rect = (_rectCallback != null ? _rectCallback() : Offset.zero & referenceBox.size); final Rect rect = _rectCallback != null ? _rectCallback() : Offset.zero & referenceBox.size;
if (originOffset == null) { if (originOffset == null) {
canvas.save(); canvas.save();
canvas.transform(transform.storage); canvas.transform(transform.storage);
......
...@@ -129,7 +129,7 @@ class MaterialPageRoute<T> extends PageRoute<T> { ...@@ -129,7 +129,7 @@ class MaterialPageRoute<T> extends PageRoute<T> {
@override @override
bool canTransitionFrom(TransitionRoute<dynamic> previousRoute) { bool canTransitionFrom(TransitionRoute<dynamic> previousRoute) {
return (previousRoute is MaterialPageRoute || previousRoute is CupertinoPageRoute); return previousRoute is MaterialPageRoute || previousRoute is CupertinoPageRoute;
} }
@override @override
......
...@@ -324,7 +324,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -324,7 +324,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
final List<Widget> footerWidgets = <Widget>[]; final List<Widget> footerWidgets = <Widget>[];
if (widget.onRowsPerPageChanged != null) { if (widget.onRowsPerPageChanged != null) {
final List<Widget> availableRowsPerPage = widget.availableRowsPerPage final List<Widget> availableRowsPerPage = widget.availableRowsPerPage
.where((int value) => (value <= _rowCount || value == widget.rowsPerPage)) .where((int value) => value <= _rowCount || value == widget.rowsPerPage)
.map<DropdownMenuItem<int>>((int value) { .map<DropdownMenuItem<int>>((int value) {
return new DropdownMenuItem<int>( return new DropdownMenuItem<int>(
value: value, value: value,
......
...@@ -363,7 +363,7 @@ class _StadiumToRoundedRectangleBorder extends ShapeBorder { ...@@ -363,7 +363,7 @@ class _StadiumToRoundedRectangleBorder extends ShapeBorder {
return BorderRadius.lerp( return BorderRadius.lerp(
borderRadius, borderRadius,
new BorderRadius.all(new Radius.circular(rect.shortestSide / 2.0)), new BorderRadius.all(new Radius.circular(rect.shortestSide / 2.0)),
(1.0 - rectness) 1.0 - rectness
); );
} }
......
...@@ -703,7 +703,7 @@ class TextStyle extends Diagnosticable { ...@@ -703,7 +703,7 @@ class TextStyle extends Diagnosticable {
if (decoration != null || decorationColor != null || decorationStyle != null) { if (decoration != null || decorationColor != null || decorationStyle != null) {
final List<String> decorationDescription = <String>[]; final List<String> decorationDescription = <String>[];
if (decorationStyle != null) if (decorationStyle != null)
decorationDescription.add(describeEnum((decorationStyle))); decorationDescription.add(describeEnum(decorationStyle));
// Hide decorationColor from the default text view as it is shown in the // Hide decorationColor from the default text view as it is shown in the
// terse decoration summary as well. // terse decoration summary as well.
......
...@@ -168,7 +168,7 @@ class PaintingContext { ...@@ -168,7 +168,7 @@ class PaintingContext {
} }
bool get _isRecording { bool get _isRecording {
final bool hasCanvas = (_canvas != null); final bool hasCanvas = _canvas != null;
assert(() { assert(() {
if (hasCanvas) { if (hasCanvas) {
assert(_currentLayer != null); assert(_currentLayer != null);
...@@ -2222,7 +2222,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im ...@@ -2222,7 +2222,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
/// any way to update the semantics tree. /// any way to update the semantics tree.
void markNeedsSemanticsUpdate() { void markNeedsSemanticsUpdate() {
assert(!attached || !owner._debugDoingSemantics); assert(!attached || !owner._debugDoingSemantics);
if ((attached && owner._semanticsOwner == null)) if (attached && owner._semanticsOwner == null)
return; return;
// Dirty the semantics tree starting at `this` until we have reached a // Dirty the semantics tree starting at `this` until we have reached a
......
...@@ -515,8 +515,8 @@ abstract class RenderSliverFloatingPinnedPersistentHeader extends RenderSliverFl ...@@ -515,8 +515,8 @@ abstract class RenderSliverFloatingPinnedPersistentHeader extends RenderSliverFl
double updateGeometry() { double updateGeometry() {
final double minExtent = this.minExtent; final double minExtent = this.minExtent;
final double maxExtent = this.maxExtent; final double maxExtent = this.maxExtent;
final double paintExtent = (maxExtent - _effectiveScrollOffset); final double paintExtent = maxExtent - _effectiveScrollOffset;
final double layoutExtent = (maxExtent - constraints.scrollOffset); final double layoutExtent = maxExtent - constraints.scrollOffset;
geometry = new SliverGeometry( geometry = new SliverGeometry(
scrollExtent: maxExtent, scrollExtent: maxExtent,
paintExtent: paintExtent.clamp(minExtent, constraints.remainingPaintExtent), paintExtent: paintExtent.clamp(minExtent, constraints.remainingPaintExtent),
......
...@@ -2965,7 +2965,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { ...@@ -2965,7 +2965,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
assert(owner != null); assert(owner != null);
assert(depth != null); assert(depth != null);
assert(!_active); assert(!_active);
final bool hadDependencies = ((_dependencies != null && _dependencies.isNotEmpty) || _hadUnsatisfiedDependencies); final bool hadDependencies = (_dependencies != null && _dependencies.isNotEmpty) || _hadUnsatisfiedDependencies;
_active = true; _active = true;
// We unregistered our dependencies in deactivate, but never cleared the list. // We unregistered our dependencies in deactivate, but never cleared the list.
// Since we're going to be reused, let's clear our list now. // Since we're going to be reused, let's clear our list now.
......
...@@ -362,7 +362,7 @@ class _GlowController extends ChangeNotifier { ...@@ -362,7 +362,7 @@ class _GlowController extends ChangeNotifier {
_glowOpacityTween.end = math.min(_glowOpacity.value + overscroll / extent * _pullOpacityGlowFactor, _maxOpacity); _glowOpacityTween.end = math.min(_glowOpacity.value + overscroll / extent * _pullOpacityGlowFactor, _maxOpacity);
final double height = math.min(extent, crossExtent * _kWidthToHeightFactor); final double height = math.min(extent, crossExtent * _kWidthToHeightFactor);
_glowSizeTween.begin = _glowSize.value; _glowSizeTween.begin = _glowSize.value;
_glowSizeTween.end = math.max((1.0 - 1.0 / (0.7 * math.sqrt(_pullDistance * height))), _glowSize.value); _glowSizeTween.end = math.max(1.0 - 1.0 / (0.7 * math.sqrt(_pullDistance * height)), _glowSize.value);
_displacementTarget = crossAxisOffset / crossExtent; _displacementTarget = crossAxisOffset / crossExtent;
if (_displacementTarget != _displacement) { if (_displacementTarget != _displacement) {
if (!_displacementTicker.isTicking) { if (!_displacementTicker.isTicking) {
......
...@@ -40,12 +40,11 @@ class PerformanceOverlay extends LeafRenderObjectWidget { ...@@ -40,12 +40,11 @@ class PerformanceOverlay extends LeafRenderObjectWidget {
this.rasterizerThreshold: 0, this.rasterizerThreshold: 0,
this.checkerboardRasterCacheImages: false, this.checkerboardRasterCacheImages: false,
this.checkerboardOffscreenLayers: false }) this.checkerboardOffscreenLayers: false })
: optionsMask = ( : optionsMask =
1 << PerformanceOverlayOption.displayRasterizerStatistics.index | 1 << PerformanceOverlayOption.displayRasterizerStatistics.index |
1 << PerformanceOverlayOption.visualizeRasterizerStatistics.index | 1 << PerformanceOverlayOption.visualizeRasterizerStatistics.index |
1 << PerformanceOverlayOption.displayEngineStatistics.index | 1 << PerformanceOverlayOption.displayEngineStatistics.index |
1 << PerformanceOverlayOption.visualizeEngineStatistics.index 1 << PerformanceOverlayOption.visualizeEngineStatistics.index,
),
super(key: key); super(key: key);
/// The mask is created by shifting 1 by the index of the specific /// The mask is created by shifting 1 by the index of the specific
......
...@@ -356,9 +356,9 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker ...@@ -356,9 +356,9 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
if (element.widget.key is ValueKey<dynamic>) { if (element.widget.key is ValueKey<dynamic>) {
final ValueKey<dynamic> key = element.widget.key; final ValueKey<dynamic> key = element.widget.key;
String keyLabel; String keyLabel;
if ((key is ValueKey<int> || if (key is ValueKey<int> ||
key is ValueKey<double> || key is ValueKey<double> ||
key is ValueKey<bool>)) { key is ValueKey<bool>) {
keyLabel = 'const ${element.widget.key.runtimeType}(${key.value})'; keyLabel = 'const ${element.widget.key.runtimeType}(${key.value})';
} else if (key is ValueKey<String>) { } else if (key is ValueKey<String>) {
keyLabel = 'const Key(\'${key.value}\')'; keyLabel = 'const Key(\'${key.value}\')';
......
...@@ -42,7 +42,7 @@ Future<Null> main(List<String> args) async { ...@@ -42,7 +42,7 @@ Future<Null> main(List<String> args) async {
(args.length == 2 && verbose && args.last == 'doctor'); (args.length == 2 && verbose && args.last == 'doctor');
final bool help = args.contains('-h') || args.contains('--help') || final bool help = args.contains('-h') || args.contains('--help') ||
(args.isNotEmpty && args.first == 'help') || (args.length == 1 && verbose); (args.isNotEmpty && args.first == 'help') || (args.length == 1 && verbose);
final bool muteCommandLogging = (help || doctor); final bool muteCommandLogging = help || doctor;
final bool verboseHelp = help && verbose; final bool verboseHelp = help && verbose;
await runner.run(args, <FlutterCommand>[ await runner.run(args, <FlutterCommand>[
......
...@@ -42,7 +42,7 @@ abstract class AnalyzeBase { ...@@ -42,7 +42,7 @@ abstract class AnalyzeBase {
void writeBenchmark(Stopwatch stopwatch, int errorCount, int membersMissingDocumentation) { void writeBenchmark(Stopwatch stopwatch, int errorCount, int membersMissingDocumentation) {
const String benchmarkOut = 'analysis_benchmark.json'; const String benchmarkOut = 'analysis_benchmark.json';
final Map<String, dynamic> data = <String, dynamic>{ final Map<String, dynamic> data = <String, dynamic>{
'time': (stopwatch.elapsedMilliseconds / 1000.0), 'time': stopwatch.elapsedMilliseconds / 1000.0,
'issues': errorCount, 'issues': errorCount,
'missingDartDocs': membersMissingDocumentation 'missingDartDocs': membersMissingDocumentation
}; };
......
...@@ -82,7 +82,7 @@ List<Plugin> _findPlugins(String directory) { ...@@ -82,7 +82,7 @@ List<Plugin> _findPlugins(String directory) {
bool _writeFlutterPluginsList(String directory, List<Plugin> plugins) { bool _writeFlutterPluginsList(String directory, List<Plugin> plugins) {
final File pluginsProperties = fs.file(fs.path.join(directory, '.flutter-plugins')); final File pluginsProperties = fs.file(fs.path.join(directory, '.flutter-plugins'));
final String previousFlutterPlugins = final String previousFlutterPlugins =
(pluginsProperties.existsSync() ? pluginsProperties.readAsStringSync() : null); pluginsProperties.existsSync() ? pluginsProperties.readAsStringSync() : null;
final String pluginManifest = final String pluginManifest =
plugins.map((Plugin p) => '${p.name}=${escapePath(p.path)}').join('\n'); plugins.map((Plugin p) => '${p.name}=${escapePath(p.path)}').join('\n');
if (pluginManifest.isNotEmpty) { if (pluginManifest.isNotEmpty) {
...@@ -93,7 +93,7 @@ bool _writeFlutterPluginsList(String directory, List<Plugin> plugins) { ...@@ -93,7 +93,7 @@ bool _writeFlutterPluginsList(String directory, List<Plugin> plugins) {
} }
} }
final String currentFlutterPlugins = final String currentFlutterPlugins =
(pluginsProperties.existsSync() ? pluginsProperties.readAsStringSync() : null); pluginsProperties.existsSync() ? pluginsProperties.readAsStringSync() : null;
return currentFlutterPlugins != previousFlutterPlugins; return currentFlutterPlugins != previousFlutterPlugins;
} }
......
...@@ -269,7 +269,7 @@ bool _isServiceMap(Map<String, dynamic> m) { ...@@ -269,7 +269,7 @@ bool _isServiceMap(Map<String, dynamic> m) {
return (m != null) && (m['type'] != null); return (m != null) && (m['type'] != null);
} }
bool _hasRef(String type) => (type != null) && type.startsWith('@'); bool _hasRef(String type) => (type != null) && type.startsWith('@');
String _stripRef(String type) => (_hasRef(type) ? type.substring(1) : type); String _stripRef(String type) => _hasRef(type) ? type.substring(1) : type;
/// Given a raw response from the service protocol and a [ServiceObjectOwner], /// Given a raw response from the service protocol and a [ServiceObjectOwner],
/// recursively walk the response and replace values that are service maps with /// recursively walk the response and replace values that are service maps with
...@@ -522,13 +522,13 @@ class ServiceEvent extends ServiceObject { ...@@ -522,13 +522,13 @@ class ServiceEvent extends ServiceObject {
} }
bool get isPauseEvent { bool get isPauseEvent {
return (kind == kPauseStart || return kind == kPauseStart ||
kind == kPauseExit || kind == kPauseExit ||
kind == kPauseBreakpoint || kind == kPauseBreakpoint ||
kind == kPauseInterrupted || kind == kPauseInterrupted ||
kind == kPauseException || kind == kPauseException ||
kind == kPausePostRequest || kind == kPausePostRequest ||
kind == kNone); kind == kNone;
} }
} }
...@@ -1192,7 +1192,7 @@ class Isolate extends ServiceObjectOwner { ...@@ -1192,7 +1192,7 @@ class Isolate extends ServiceObjectOwner {
} }
Future<bool> flutterFrameworkPresent() async { Future<bool> flutterFrameworkPresent() async {
return (await invokeFlutterExtensionRpcRaw('ext.flutter.frameworkPresent') != null); return await invokeFlutterExtensionRpcRaw('ext.flutter.frameworkPresent') != null;
} }
Future<Map<String, dynamic>> uiWindowScheduleFrame() async { Future<Map<String, dynamic>> uiWindowScheduleFrame() async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment