Commit 2958d7d0 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

use bool in assert (#12170)

parent cde6b669
......@@ -186,7 +186,7 @@ class GalleryHomeState extends State<GalleryHome> with SingleTickerProviderState
assert(() {
showPreviewBanner = false;
return true;
});
}());
if (showPreviewBanner) {
home = new Stack(
......
......@@ -331,7 +331,7 @@ List<GalleryItem> _buildGalleryItems() {
),
);
return true;
});
}());
return galleryItems;
}
......
......@@ -114,7 +114,7 @@ class StocksAppState extends State<StocksApp> {
debugPaintPointersEnabled = _configuration.debugShowPointers;
debugRepaintRainbowEnabled = _configuration.debugShowRainbow;
return true;
});
}());
return new MaterialApp(
title: 'Stocks',
theme: theme,
......
......@@ -199,7 +199,7 @@ class StockSettingsState extends State<StockSettings> {
),
]);
return true;
});
}());
return new ListView(
padding: const EdgeInsets.symmetric(vertical: 20.0),
children: rows,
......
......@@ -284,7 +284,7 @@ class AnimationController extends Animation<double>
);
}
return true;
});
}());
_direction = _AnimationDirection.forward;
if (from != null)
value = from;
......@@ -312,7 +312,7 @@ class AnimationController extends Animation<double>
);
}
return true;
});
}());
_direction = _AnimationDirection.reverse;
if (from != null)
value = from;
......@@ -349,7 +349,7 @@ class AnimationController extends Animation<double>
);
}
return true;
});
}());
final double range = upperBound - lowerBound;
final double remainingFraction = range.isFinite ? (target - _value).abs() / range : 1.0;
simulationDuration = this.duration * remainingFraction;
......@@ -399,7 +399,7 @@ class AnimationController extends Animation<double>
);
}
return true;
});
}());
return animateWith(new _RepeatingSimulation(min, max, period));
}
......@@ -483,7 +483,7 @@ class AnimationController extends Animation<double>
);
}
return true;
});
}());
_ticker.dispose();
_ticker = null;
super.dispose();
......
......@@ -405,7 +405,7 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do
);
}
return true;
});
}());
return t;
}
return activeCurve.transform(t);
......
......@@ -131,7 +131,7 @@ class CupertinoPageRoute<T> extends PageRoute<T> {
'Cannot install a subsidiary route (one with a hostRoute).\n'
'This route ($this) cannot be installed, because it has a host route ($hostRoute).'
);
});
}());
super.install(insertionPoint);
}
......@@ -238,7 +238,7 @@ class CupertinoPageRoute<T> extends PageRoute<T> {
);
}
return true;
});
}());
return result;
}
......
......@@ -136,7 +136,7 @@ class CupertinoTabView extends StatelessWidget {
);
}
return true;
});
}());
final Route<dynamic> result = onUnknownRoute(settings);
assert(() {
if (result == null) {
......@@ -148,7 +148,7 @@ class CupertinoTabView extends StatelessWidget {
);
}
return true;
});
}());
return result;
}
}
\ No newline at end of file
......@@ -222,7 +222,7 @@ class FlutterError extends AssertionError {
// In checked mode, we ignore the "silent" flag.
reportError = true;
return true;
});
}());
if (!reportError && !forceReport)
return;
if (_errorCount == 0 || forceReport) {
......
......@@ -77,7 +77,7 @@ abstract class BindingBase {
@mustCallSuper
void initInstances() {
assert(!_debugInitialized);
assert(() { _debugInitialized = true; return true; });
assert(() { _debugInitialized = true; return true; }());
}
/// Called when the binding is initialized, to register service
......@@ -145,8 +145,8 @@ abstract class BindingBase {
}
);
return true;
});
assert(() { _debugServiceExtensionsRegistered = true; return true; });
}());
assert(() { _debugServiceExtensionsRegistered = true; return true; }());
}
/// Whether [lockEvents] is currently locking events.
......
......@@ -54,7 +54,7 @@ class ChangeNotifier extends Listenable {
);
}
return true;
});
}());
return true;
}
......@@ -63,7 +63,7 @@ class ChangeNotifier extends Listenable {
/// This method must not be called after [dispose] has been called.
@override
void addListener(VoidCallback listener) {
assert(_debugAssertNotDisposed);
assert(_debugAssertNotDisposed());
_listeners.add(listener);
}
......@@ -88,7 +88,7 @@ class ChangeNotifier extends Listenable {
/// registrations to a common upstream object.
@override
void removeListener(VoidCallback listener) {
assert(_debugAssertNotDisposed);
assert(_debugAssertNotDisposed());
_listeners.remove(listener);
}
......@@ -100,7 +100,7 @@ class ChangeNotifier extends Listenable {
/// This method should only be called by the object's owner.
@mustCallSuper
void dispose() {
assert(_debugAssertNotDisposed);
assert(_debugAssertNotDisposed());
_listeners = null;
}
......@@ -121,7 +121,7 @@ class ChangeNotifier extends Listenable {
/// See the discussion at [removeListener].
@protected
void notifyListeners() {
assert(_debugAssertNotDisposed);
assert(_debugAssertNotDisposed());
if (_listeners != null) {
final List<VoidCallback> localListeners = new List<VoidCallback>.from(_listeners);
for (VoidCallback listener in localListeners) {
......
......@@ -25,7 +25,7 @@ bool debugAssertAllFoundationVarsUnset(String reason, { DebugPrintCallback debug
debugDefaultTargetPlatformOverride != null)
throw new FlutterError(reason);
return true;
});
}());
return true;
}
......
......@@ -45,7 +45,7 @@ TargetPlatform get defaultTargetPlatform {
if (debugDefaultTargetPlatformOverride != null)
result = debugDefaultTargetPlatformOverride;
return true;
});
}());
if (result == null) {
throw new FlutterError(
'Unknown platform.\n'
......
......@@ -271,7 +271,7 @@ class GestureArenaManager {
debugPrint('Gesture arena ${pointer.toString().padRight(4)}$message${ count != null ? " with $count member$s." : ""}');
}
return true;
});
}());
return true;
}
}
......@@ -89,7 +89,7 @@ abstract class GestureBinding extends BindingBase with HitTestable, HitTestDispa
if (debugPrintHitTestResults)
debugPrint('$event: $result');
return true;
});
}());
} else if (event is PointerUpEvent || event is PointerCancelEvent) {
result = _hitTests.remove(event.pointer);
} else if (event.down) {
......
......@@ -54,6 +54,6 @@ bool debugAssertAllGesturesVarsUnset(String reason) {
debugPrintRecognizerCallbacksTrace)
throw new FlutterError(reason);
return true;
});
}());
return true;
}
......@@ -163,7 +163,7 @@ abstract class MultiDragPointerState {
void dispose() {
_arenaEntry?.resolve(GestureDisposition.rejected);
_arenaEntry = null;
assert(() { _pendingDelta = null; return true; });
assert(() { _pendingDelta = null; return true; }());
}
}
......
......@@ -98,7 +98,7 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
debugPrint('$prefix$this calling $name callback.${ report?.isNotEmpty == true ? " $report" : "" }');
}
return true;
});
}());
result = callback();
} catch (exception, stack) {
FlutterError.reportError(new FlutterErrorDetails(
......
......@@ -504,7 +504,7 @@ class _MaterialAppState extends State<MaterialApp> {
);
}
return true;
});
}());
final Route<dynamic> result = widget.onUnknownRoute(settings);
assert(() {
if (result == null) {
......@@ -516,7 +516,7 @@ class _MaterialAppState extends State<MaterialApp> {
);
}
return true;
});
}());
return result;
}
......@@ -569,7 +569,7 @@ class _MaterialAppState extends State<MaterialApp> {
);
}
return true;
});
}());
return new ScrollConfiguration(
behavior: new _MaterialScrollBehavior(),
......
......@@ -38,6 +38,6 @@ bool debugCheckHasMaterial(BuildContext context) {
);
}
return true;
});
}());
return true;
}
......@@ -226,7 +226,7 @@ class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
assert(menuTop + menuHeight <= size.height);
}
return true;
});
}());
return new Offset(buttonRect.left.clamp(0.0, size.width - childSize.width), menuTop);
}
......
......@@ -394,7 +394,7 @@ abstract class InkFeature {
@mustCallSuper
void dispose() {
assert(!_debugDisposed);
assert(() { _debugDisposed = true; return true; });
assert(() { _debugDisposed = true; return true; }());
_controller._removeFeature(this);
if (onRemoved != null)
onRemoved();
......
......@@ -282,7 +282,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
);
}
return true;
});
}());
return _icuTimeOfDayToEnum[icuShortTimePattern];
}
......
......@@ -134,7 +134,7 @@ class MaterialPageRoute<T> extends PageRoute<T> {
);
}
return true;
});
}());
return result;
}
......
......@@ -85,7 +85,7 @@ class PaginatedDataTable extends StatefulWidget {
if (onRowsPerPageChanged != null)
assert(availableRowsPerPage != null && availableRowsPerPage.contains(rowsPerPage));
return true;
}),
}()),
assert(source != null),
super(key: key);
......
......@@ -626,7 +626,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
'https://material.google.com/components/steppers.html#steppers-usage\n'
);
return true;
});
}());
assert(widget.type != null);
switch (widget.type) {
case StepperType.vertical:
......
......@@ -546,7 +546,7 @@ class _TabBarState extends State<TabBar> {
);
}
return true;
});
}());
if (newController == _controller)
return;
......@@ -855,7 +855,7 @@ class _TabBarViewState extends State<TabBarView> {
);
}
return true;
});
}());
if (newController == _controller)
return;
......@@ -1113,7 +1113,7 @@ class TabPageSelector extends StatelessWidget {
);
}
return true;
});
}());
final Animation<double> animation = new CurvedAnimation(
parent: tabController.animation,
curve: Curves.fastOutSlowIn,
......
......@@ -162,7 +162,7 @@ class FlutterLogoDecoration extends Decoration {
assert(debugAssertIsValid());
if (a is! FlutterLogoDecoration)
return lerp(null, this, t);
assert(a.debugAssertIsValid);
assert(a.debugAssertIsValid());
return lerp(a, this, t);
}
......
......@@ -367,7 +367,7 @@ class TextPainter {
);
}
return true;
});
}());
canvas.drawParagraph(_paragraph, offset);
}
......
......@@ -275,7 +275,7 @@ class TextSpan extends DiagnosticableTree {
);
}
return true;
});
}());
return true;
}
......
......@@ -86,7 +86,7 @@ abstract class RendererBinding extends BindingBase with SchedulerBinding, Servic
}
);
return true;
});
}());
registerSignalServiceExtension(
name: 'debugDumpRenderTree',
......
......@@ -98,7 +98,7 @@ class RenderListBody extends RenderBox
'axis. You probably want to put the RenderListBody inside a '
'RenderViewport with a matching main axis.'
);
});
}());
assert(() {
switch (mainAxis) {
case Axis.horizontal:
......@@ -123,7 +123,7 @@ class RenderListBody extends RenderBox
'for example, a RenderIntrinsicWidth or RenderIntrinsicHeight object. '
'This is relatively expensive, however.' // (that's why we don't do it automatically)
);
});
}());
final BoxConstraints innerConstraints = _getInnerConstraints(constraints);
double position = 0.0;
RenderBox child = firstChild;
......
......@@ -260,7 +260,7 @@ class BoxConstraints extends Constraints {
if (size is _DebugSize)
result = new _DebugSize(result, size._owner, size._canBeUsedByParent);
return true;
});
}());
return result;
}
......@@ -271,7 +271,7 @@ class BoxConstraints extends Constraints {
/// separately provided widths and heights.
Size constrain(Size size) {
Size result = new Size(constrainWidth(size.width), constrainHeight(size.height));
assert(() { result = _debugPropagateDebugSize(size, result); return true; });
assert(() { result = _debugPropagateDebugSize(size, result); return true; }());
return result;
}
......@@ -294,7 +294,7 @@ class BoxConstraints extends Constraints {
Size constrainSizeAndAttemptToPreserveAspectRatio(Size size) {
if (isTight) {
Size result = smallest;
assert(() { result = _debugPropagateDebugSize(size, result); return true; });
assert(() { result = _debugPropagateDebugSize(size, result); return true; }());
return result;
}
......@@ -325,7 +325,7 @@ class BoxConstraints extends Constraints {
}
Size result = new Size(constrainWidth(width), constrainHeight(height));
assert(() { result = _debugPropagateDebugSize(size, result); return true; });
assert(() { result = _debugPropagateDebugSize(size, result); return true; }());
return result;
}
......@@ -495,7 +495,7 @@ class BoxConstraints extends Constraints {
}
assert(isNormalized);
return true;
});
}());
return isNormalized;
}
......@@ -1038,7 +1038,7 @@ abstract class RenderBox extends RenderObject {
if (RenderObject.debugCheckingIntrinsics)
shouldCache = false;
return true;
});
}());
if (shouldCache) {
_cachedIntrinsicDimensions ??= <_IntrinsicDimensionsCacheEntry, double>{};
return _cachedIntrinsicDimensions.putIfAbsent(
......@@ -1085,7 +1085,7 @@ abstract class RenderBox extends RenderObject {
);
}
return true;
});
}());
return _computeIntrinsicDimension(_IntrinsicDimension.minWidth, height, computeMinIntrinsicWidth);
}
......@@ -1224,7 +1224,7 @@ abstract class RenderBox extends RenderObject {
);
}
return true;
});
}());
return _computeIntrinsicDimension(_IntrinsicDimension.maxWidth, height, computeMaxIntrinsicWidth);
}
......@@ -1300,7 +1300,7 @@ abstract class RenderBox extends RenderObject {
);
}
return true;
});
}());
return _computeIntrinsicDimension(_IntrinsicDimension.minHeight, width, computeMinIntrinsicHeight);
}
......@@ -1373,7 +1373,7 @@ abstract class RenderBox extends RenderObject {
);
}
return true;
});
}());
return _computeIntrinsicDimension(_IntrinsicDimension.maxHeight, width, computeMaxIntrinsicHeight);
}
......@@ -1443,7 +1443,7 @@ abstract class RenderBox extends RenderObject {
assert(_size == this._size);
}
return true;
});
}());
return _size;
}
Size _size;
......@@ -1481,13 +1481,13 @@ abstract class RenderBox extends RenderObject {
'The RenderBox in question is:\n'
' $this'
);
});
}());
assert(() {
value = debugAdoptSize(value);
return true;
});
}());
_size = value;
assert(() { debugAssertDoesMeetConstraints(); return true; });
assert(() { debugAssertDoesMeetConstraints(); return true; }());
}
/// Claims ownership of the given [Size].
......@@ -1549,7 +1549,7 @@ abstract class RenderBox extends RenderObject {
}
result = new _DebugSize(value, this, debugCanParentUseSize);
return true;
});
}());
return result;
}
......@@ -1594,7 +1594,7 @@ abstract class RenderBox extends RenderObject {
((RenderObject.debugActivePaint == this) && debugDoingThisPaint);
assert(parent == this.parent);
return false;
});
}());
assert(_debugSetDoingBaseline(true));
final double result = getDistanceToActualBaseline(baseline);
assert(_debugSetDoingBaseline(false));
......@@ -1752,7 +1752,7 @@ abstract class RenderBox extends RenderObject {
}
}
return true;
});
}());
}
@override
......@@ -1793,7 +1793,7 @@ abstract class RenderBox extends RenderObject {
);
}
return true;
});
}());
}
/// Determines the set of render objects located at the given position.
......@@ -1840,7 +1840,7 @@ abstract class RenderBox extends RenderObject {
);
}
return true;
});
}());
if (_size.contains(position)) {
if (hitTestChildren(result, position: position) || hitTestSelf(position)) {
result.add(new BoxHitTestEntry(this, position));
......@@ -1901,7 +1901,7 @@ abstract class RenderBox extends RenderObject {
);
}
return true;
});
}());
final BoxParentData childParentData = child.parentData;
final Offset offset = childParentData.offset;
transform.translate(offset.dx, offset.dy);
......@@ -2004,7 +2004,7 @@ abstract class RenderBox extends RenderObject {
markNeedsPaint();
}
return true;
});
}());
return true;
}
......@@ -2018,7 +2018,7 @@ abstract class RenderBox extends RenderObject {
if (debugPaintPointersEnabled)
debugPaintPointers(context, offset);
return true;
});
}());
}
/// In debug mode, paints a border around this render box.
......@@ -2033,7 +2033,7 @@ abstract class RenderBox extends RenderObject {
..color = const Color(0xFF00FFFF);
context.canvas.drawRect((offset & size).deflate(0.5), paint);
return true;
});
}());
}
/// In debug mode, paints a line for each baseline.
......@@ -2065,7 +2065,7 @@ abstract class RenderBox extends RenderObject {
context.canvas.drawPath(path, paint);
}
return true;
});
}());
}
/// In debug mode, paints a rectangle if this render box has counted more
......@@ -2084,7 +2084,7 @@ abstract class RenderBox extends RenderObject {
context.canvas.drawRect(offset & size, paint);
}
return true;
});
}());
}
@override
......
......@@ -120,7 +120,7 @@ abstract class MultiChildLayoutDelegate {
);
}
return true;
});
}());
child.layout(constraints, parentUsesSize: true);
return child.size;
}
......@@ -146,7 +146,7 @@ abstract class MultiChildLayoutDelegate {
);
}
return true;
});
}());
final MultiChildLayoutParentData childParentData = child.parentData;
childParentData.offset = offset;
}
......@@ -167,7 +167,7 @@ abstract class MultiChildLayoutDelegate {
debugPreviousChildrenNeedingLayout = _debugChildrenNeedingLayout;
_debugChildrenNeedingLayout = new Set<RenderBox>();
return true;
});
}());
try {
_idToChild = <Object, RenderBox>{};
......@@ -183,12 +183,12 @@ abstract class MultiChildLayoutDelegate {
);
}
return true;
});
}());
_idToChild[childParentData.id] = child;
assert(() {
_debugChildrenNeedingLayout.add(child);
return true;
});
}());
child = childParentData.nextSibling;
}
performLayout(size);
......@@ -209,13 +209,13 @@ abstract class MultiChildLayoutDelegate {
}
}
return true;
});
}());
} finally {
_idToChild = previousIdToChild;
assert(() {
_debugChildrenNeedingLayout = debugPreviousChildrenNeedingLayout;
return true;
});
}());
}
}
......
......@@ -203,7 +203,7 @@ void debugPaintPadding(Canvas canvas, Rect outerRect, Rect innerRect, { double o
canvas.drawRect(outerRect, paint);
}
return true;
});
}());
}
/// Returns true if none of the rendering library debug variables have been changed.
......@@ -234,6 +234,6 @@ bool debugAssertAllRenderVarsUnset(String reason, { bool debugCheckIntrinsicSize
throw new FlutterError(reason);
}
return true;
});
}());
return true;
}
......@@ -705,7 +705,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
'If none of the above helps enough to fix this problem, please don\'t hesitate to file a bug:\n'
' https://github.com/flutter/flutter/issues/new'
);
});
}());
totalFlex += childParentData.flex;
} else {
BoxConstraints innerConstraints;
......@@ -798,7 +798,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if (textBaseline == null)
throw new FlutterError('To use FlexAlignItems.baseline, you must also specify which baseline to use using the "baseline" argument.');
return true;
});
}());
final double distance = child.getDistanceToBaseline(textBaseline, onlyReal: true);
if (distance != null)
maxBaselineDistance = math.max(maxBaselineDistance, distance);
......@@ -1017,7 +1017,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
return true;
});
}());
}
@override
......
......@@ -326,7 +326,7 @@ class RenderFlow extends RenderBox
);
}
return true;
});
}());
_lastPaintOrder.add(i);
childParentData._transform = transform;
......
......@@ -76,7 +76,7 @@ abstract class Layer extends AbstractNode with DiagnosticableTreeMixin {
node = node.parent;
assert(node != newLayer); // indicates we are about to create a cycle
return true;
});
}());
parent.adoptChild(newLayer);
assert(newLayer.attached == parent.attached);
if (parent.firstChild == this)
......@@ -299,7 +299,7 @@ class ContainerLayer extends Layer {
node = node.parent;
assert(node != child); // indicates we are about to create a cycle
return true;
});
}());
adoptChild(child);
child._previousSibling = lastChild;
if (lastChild != null)
......
......@@ -122,7 +122,7 @@ class AbstractNode {
node = node.parent;
assert(node != child); // indicates we are about to create a cycle
return true;
});
}());
child._parent = this;
if (attached)
child.attach(_owner);
......
......@@ -331,7 +331,7 @@ class RenderParagraph extends RenderBox {
canvas.drawRect(offset & size, paint);
}
return true;
});
}());
if (_hasVisualOverflow) {
final Rect bounds = offset & size;
......
......@@ -272,7 +272,7 @@ class RenderConstrainedBox extends RenderProxyBox {
context.canvas.drawRect(offset & size, paint);
}
return true;
});
}());
}
@override
......@@ -463,7 +463,7 @@ class RenderAspectRatio extends RenderProxyBox {
);
}
return true;
});
}());
if (constraints.isTight)
return constraints.smallest;
......@@ -1043,7 +1043,7 @@ abstract class _RenderCustomClip<T> extends RenderProxyBox {
)
..layout();
return true;
});
}());
}
}
......@@ -1093,7 +1093,7 @@ class RenderClipRect extends _RenderCustomClip<Rect> {
_debugText.paint(context.canvas, offset + new Offset(_clip.width / 8.0, -_debugText.text.style.fontSize * 1.1));
}
return true;
});
}());
}
}
......@@ -1164,7 +1164,7 @@ class RenderClipRRect extends _RenderCustomClip<RRect> {
_debugText.paint(context.canvas, offset + new Offset(_clip.tlRadiusX, -_debugText.text.style.fontSize * 1.1));
}
return true;
});
}());
}
}
......@@ -1228,7 +1228,7 @@ class RenderClipOval extends _RenderCustomClip<Rect> {
_debugText.paint(context.canvas, offset + new Offset((_clip.width - _debugText.width) / 2.0, -_debugText.text.style.fontSize * 1.1));
}
return true;
});
}());
}
}
......@@ -1286,7 +1286,7 @@ class RenderClipPath extends _RenderCustomClip<Path> {
_debugText.paint(context.canvas, offset);
}
return true;
});
}());
}
}
......@@ -1555,7 +1555,7 @@ class RenderDecoratedBox extends RenderProxyBox {
assert(() {
debugSaveCount = context.canvas.getSaveCount();
return true;
});
}());
_painter.paint(context.canvas, offset, filledConfiguration);
assert(() {
if (debugSaveCount != context.canvas.getSaveCount()) {
......@@ -1571,7 +1571,7 @@ class RenderDecoratedBox extends RenderProxyBox {
);
}
return true;
});
}());
if (decoration.isComplex)
context.setIsComplexHint();
}
......@@ -2294,7 +2294,7 @@ class RenderCustomPaint extends RenderProxyBox {
void _paintWithPainter(Canvas canvas, Offset offset, CustomPainter painter) {
int debugPreviousCanvasSaveCount;
canvas.save();
assert(() { debugPreviousCanvasSaveCount = canvas.getSaveCount(); return true; });
assert(() { debugPreviousCanvasSaveCount = canvas.getSaveCount(); return true; }());
if (offset != Offset.zero)
canvas.translate(offset.dx, offset.dy);
painter.paint(canvas, size);
......@@ -2328,7 +2328,7 @@ class RenderCustomPaint extends RenderProxyBox {
);
}
return debugNewCanvasSaveCount == debugPreviousCanvasSaveCount;
});
}());
canvas.restore();
}
......@@ -2513,7 +2513,7 @@ class RenderRepaintBoundary extends RenderProxyBox {
_debugSymmetricPaintCount = 0;
_debugAsymmetricPaintCount = 0;
return true;
});
}());
}
@override
......@@ -2524,7 +2524,7 @@ class RenderRepaintBoundary extends RenderProxyBox {
else
_debugAsymmetricPaintCount += 1;
return true;
});
}());
}
@override
......@@ -2557,7 +2557,7 @@ class RenderRepaintBoundary extends RenderProxyBox {
description.add(new MessageProperty('diagnosis', diagnosis));
}
return true;
});
}());
if (inReleaseMode)
description.add(new DiagnosticsNode.message('(run in checked mode to collect repaint boundary statistics)'));
}
......
......@@ -467,13 +467,13 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
ancestor = ancestor.parent;
assert(!_newChildren.any((SemanticsNode child) => child == ancestor));
return true;
});
}());
assert(() {
final Set<SemanticsNode> seenChildren = new Set<SemanticsNode>();
for (SemanticsNode child in _newChildren)
assert(seenChildren.add(child)); // check for duplicate adds
return true;
});
}());
}
/// Contains the children in inverse hit test order (i.e. paint order).
......
......@@ -202,7 +202,7 @@ class RenderPadding extends RenderShiftedBox {
final Rect outerRect = offset & size;
debugPaintPadding(context.canvas, outerRect, child != null ? _resolvedPadding.deflateRect(outerRect) : null);
return true;
});
}());
}
@override
......@@ -422,7 +422,7 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
context.canvas.drawRect(offset & size, paint);
}
return true;
});
}());
}
@override
......
......@@ -453,7 +453,7 @@ class SliverConstraints extends Constraints {
verify(remainingPaintExtent >= 0.0, 'The "remainingPaintExtent" is negative.');
verify(isNormalized, 'The constraints are not normalized.'); // should be redundant with earlier checks
return true;
});
}());
return true;
}
......@@ -669,7 +669,7 @@ class SliverGeometry extends Diagnosticable {
verify(hasVisualOverflow != null, 'The "hasVisualOverflow" is null.');
verify(scrollOffsetCorrection != 0.0, 'The "scrollOffsetCorrection" is zero.');
return true;
});
}());
return true;
}
......@@ -991,7 +991,7 @@ abstract class RenderSliver extends RenderObject {
'The RenderSliver in question is:\n'
' $this'
);
});
}());
_geometry = value;
}
......@@ -1042,7 +1042,7 @@ abstract class RenderSliver extends RenderObject {
);
}
return true;
});
}());
}
@override
......@@ -1195,7 +1195,7 @@ abstract class RenderSliver extends RenderObject {
double childMainAxisPosition(covariant RenderObject child) {
assert(() {
throw new FlutterError('$runtimeType does not implement childPosition.');
});
}());
return 0.0;
}
......@@ -1232,7 +1232,7 @@ abstract class RenderSliver extends RenderObject {
void applyPaintTransform(RenderObject child, Matrix4 transform) {
assert(() {
throw new FlutterError('$runtimeType does not implement applyPaintTransform.');
});
}());
}
/// This returns a [Size] with dimensions relative to the leading edge of the
......@@ -1291,7 +1291,7 @@ abstract class RenderSliver extends RenderObject {
paint
);
return true;
});
}());
}
@override
......@@ -1358,7 +1358,7 @@ abstract class RenderSliver extends RenderObject {
}
}
return true;
});
}());
}
// This override exists only to change the type of the second argument.
......
......@@ -201,7 +201,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
child = childAfter(child);
}
return true;
});
}());
}
@override
......@@ -567,7 +567,7 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
child = childAfter(child);
}
return true;
});
}());
return true;
}
......
......@@ -302,7 +302,7 @@ class RenderSliverPadding extends RenderSliver with RenderObjectWithChildMixin<R
debugPaintPadding(context.canvas, outerRect, innerRect);
}
return true;
});
}());
}
@override
......
......@@ -138,7 +138,7 @@ abstract class RenderSliverPersistentHeader extends RenderSliver with RenderObje
'The specified maxExtent was: ${maxExtent.toStringAsFixed(1)}\n'
'The specified minExtent was: ${minExtent.toStringAsFixed(1)}\n'
);
});
}());
child?.layout(
constraints.asBoxConstraints(maxExtent: math.max(minExtent, maxExtent - shrinkOffset)),
parentUsesSize: true,
......
......@@ -882,7 +882,7 @@ class RenderTable extends RenderBox {
}
// beyond this point, unflexedTableWidth is no longer valid
assert(() { unflexedTableWidth = null; return true; });
assert(() { unflexedTableWidth = null; return true; }());
// 4. apply the maximum width of the table, shrinking columns as
// necessary, applying minimum column widths as we go
......
......@@ -195,7 +195,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
if (debugRepaintRainbowEnabled || debugRepaintTextRainbowEnabled)
debugCurrentRepaintColor = debugCurrentRepaintColor.withHue(debugCurrentRepaintColor.hue + 2.0);
return true;
});
}());
} finally {
Timeline.finishSync();
}
......@@ -218,7 +218,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
assert(() {
description.add(new DiagnosticsNode.message('debug mode enabled - ${Platform.operatingSystem}'));
return true;
});
}());
description.add(new DiagnosticsProperty<Size>('window size', ui.window.physicalSize, tooltip: 'in physical pixels'));
description.add(new DoubleProperty('device pixel ratio', ui.window.devicePixelRatio, tooltip: 'physical pixels per logical pixel'));
description.add(new DiagnosticsProperty<ViewConfiguration>('configuration', configuration, tooltip: 'in logical pixels'));
......
......@@ -201,7 +201,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
);
}
return true;
});
}());
return true;
}
......@@ -296,7 +296,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
), parentUsesSize: true);
final SliverGeometry childLayoutGeometry = child.geometry;
assert(childLayoutGeometry.debugAssertIsValid);
assert(childLayoutGeometry.debugAssertIsValid());
// If there is a correction to apply, we'll have to start over.
if (childLayoutGeometry.scrollOffsetCorrection != null)
......@@ -366,7 +366,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
child = childAfter(child);
}
return true;
});
}());
}
@override
......@@ -848,7 +848,7 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
}
}
return true;
});
}());
size = constraints.biggest;
// We ignore the return value of applyViewportDimension below because we are
// going to go through performLayout next regardless.
......@@ -935,7 +935,7 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
);
}
return true;
});
}());
}
double _attemptLayout(double mainAxisExtent, double crossAxisExtent, double correctedOffset) {
......@@ -1217,7 +1217,7 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
);
}
return true;
});
}());
return true;
}
......
......@@ -73,14 +73,14 @@ class _FrameCallbackEntry {
);
}
return true;
});
}());
debugStack = debugCurrentCallbackStack;
} else {
// TODO(ianh): trim the frames from this library, so that the call to scheduleFrameCallback is the top one
debugStack = StackTrace.current;
}
return true;
});
}());
}
final FrameCallback callback;
......@@ -363,7 +363,7 @@ abstract class SchedulerBinding extends BindingBase {
));
}
return true;
});
}());
return true;
}
......@@ -399,7 +399,7 @@ abstract class SchedulerBinding extends BindingBase {
debugPrint('No transient callback is currently executing.');
}
return true;
});
}());
}
final List<FrameCallback> _persistentCallbacks = <FrameCallback>[];
......@@ -503,7 +503,7 @@ abstract class SchedulerBinding extends BindingBase {
if (debugPrintScheduleFrameStacks)
debugPrintStack(label: 'scheduleFrame() called. Current phase is $schedulerPhase.');
return true;
});
}());
ui.window.scheduleFrame();
_hasScheduledFrame = true;
}
......@@ -610,7 +610,7 @@ abstract class SchedulerBinding extends BindingBase {
debugPrint(_debugBanner);
}
return true;
});
}());
assert(schedulerPhase == SchedulerPhase.idle);
_hasScheduledFrame = false;
......@@ -667,7 +667,7 @@ abstract class SchedulerBinding extends BindingBase {
debugPrint('▀' * _debugBanner.length);
_debugBanner = null;
return true;
});
}());
_currentFrameTimeStamp = null;
}
......@@ -708,7 +708,7 @@ abstract class SchedulerBinding extends BindingBase {
assert(callback != null);
assert(_FrameCallbackEntry.debugCurrentCallbackStack == null);
// TODO(ianh): Consider using a Zone instead to track the current callback registration stack
assert(() { _FrameCallbackEntry.debugCurrentCallbackStack = callbackStack; return true; });
assert(() { _FrameCallbackEntry.debugCurrentCallbackStack = callbackStack; return true; }());
try {
callback(timeStamp);
} catch (exception, exceptionStack) {
......@@ -727,7 +727,7 @@ abstract class SchedulerBinding extends BindingBase {
}
));
}
assert(() { _FrameCallbackEntry.debugCurrentCallbackStack = null; return true; });
assert(() { _FrameCallbackEntry.debugCurrentCallbackStack = null; return true; }());
}
}
......
......@@ -64,6 +64,6 @@ bool debugAssertAllSchedulerVarsUnset(String reason) {
throw new FlutterError(reason);
}
return true;
});
}());
return true;
}
......@@ -63,7 +63,7 @@ class Ticker {
assert(() {
_debugCreationStack = StackTrace.current;
return true;
});
}());
}
TickerFuture _future;
......@@ -140,7 +140,7 @@ class Ticker {
);
}
return true;
});
}());
assert(_startTime == null);
_future = new TickerFuture._();
if (shouldScheduleTick)
......@@ -290,7 +290,7 @@ class Ticker {
// catch cases of use-after-dispose.
_startTime = const Duration();
return true;
});
}());
}
/// An optional label can be provided for debugging purposes.
......@@ -306,7 +306,7 @@ class Ticker {
assert(() {
buffer.write(debugLabel ?? '');
return true;
});
}());
buffer.write(')');
assert(() {
if (debugIncludeStack) {
......@@ -315,7 +315,7 @@ class Ticker {
FlutterError.defaultStackFilter(_debugCreationStack.toString().trimRight().split('\n')).forEach(buffer.writeln);
}
return true;
});
}());
return buffer.toString();
}
}
......
......@@ -486,7 +486,7 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
);
}
return true;
});
}());
return new MediaQuery(
data: new MediaQueryData.fromWindow(ui.window),
......
......@@ -113,7 +113,7 @@ class _AutomaticKeepAliveState extends State<AutomaticKeepAlive> {
);
}
return true;
});
}());
_handles.remove(handle);
if (_handles.isEmpty) {
if (SchedulerBinding.instance.schedulerPhase.index < SchedulerPhase.persistentCallbacks.index) {
......
......@@ -343,7 +343,7 @@ class CheckedModeBanner extends StatelessWidget {
location: BannerLocation.topEnd,
);
return true;
});
}());
return result;
}
......@@ -354,7 +354,7 @@ class CheckedModeBanner extends StatelessWidget {
assert(() {
message = '"SLOW MODE"';
return true;
});
}());
description.add(new DiagnosticsNode.message(message));
}
}
......@@ -441,7 +441,7 @@ abstract class WidgetsBinding extends BindingBase with GestureBinding, RendererB
);
}
return true;
});
}());
ensureVisualUpdate();
}
......@@ -524,7 +524,7 @@ abstract class WidgetsBinding extends BindingBase with GestureBinding, RendererB
assert(() {
debugBuildingDirtyElements = true;
return true;
});
}());
try {
if (renderViewElement != null)
buildOwner.buildScope(renderViewElement);
......@@ -534,7 +534,7 @@ abstract class WidgetsBinding extends BindingBase with GestureBinding, RendererB
assert(() {
debugBuildingDirtyElements = false;
return true;
});
}());
}
// TODO(ianh): Following code should not be included in release mode, only profile and debug modes.
// See https://github.com/dart-lang/sdk/issues/27192
......@@ -613,7 +613,7 @@ void runApp(Widget app) {
void debugDumpApp() {
assert(WidgetsBinding.instance != null);
String mode = 'RELEASE MODE';
assert(() { mode = 'CHECKED MODE'; return true; });
assert(() { mode = 'CHECKED MODE'; return true; }());
debugPrint('${WidgetsBinding.instance.runtimeType} - $mode');
if (WidgetsBinding.instance.renderViewElement != null) {
debugPrint(WidgetsBinding.instance.renderViewElement.toStringDeep());
......
......@@ -113,7 +113,7 @@ bool debugChildrenHaveDuplicateKeys(Widget parent, Iterable<Widget> children) {
);
}
return true;
});
}());
return false;
}
......@@ -135,7 +135,7 @@ bool debugItemsHaveDuplicateKeys(Iterable<Widget> items) {
if (nonUniqueKey != null)
throw new FlutterError('Duplicate key found: $nonUniqueKey.');
return true;
});
}());
return false;
}
......@@ -165,7 +165,7 @@ bool debugCheckHasTable(BuildContext context) {
);
}
return true;
});
}());
return true;
}
......@@ -198,7 +198,7 @@ bool debugCheckHasMediaQuery(BuildContext context) {
);
}
return true;
});
}());
return true;
}
......@@ -220,7 +220,7 @@ void debugWidgetBuilderValue(Widget widget, Widget built) {
);
}
return true;
});
}());
}
/// Returns true if none of the widget library debug variables have been changed.
......@@ -241,6 +241,6 @@ bool debugAssertAllWidgetVarsUnset(String reason) {
throw new FlutterError(reason);
}
return true;
});
}());
return true;
}
......@@ -388,7 +388,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
);
}
return true;
});
}());
return new SizeTransition(
sizeFactor: _resizeAnimation,
......
......@@ -158,7 +158,7 @@ class FocusScopeNode extends Object with DiagnosticableTreeMixin {
node = node._parent;
assert(node != child); // indicates we are about to create a cycle
return true;
});
}());
child._parent = this;
child._nextSibling = _firstChild;
if (_firstChild != null)
......
......@@ -185,7 +185,7 @@ class GestureDetector extends StatelessWidget {
}
}
return true;
}),
}()),
super(key: key);
/// The widget below this widget in the tree.
......@@ -524,7 +524,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
);
}
return true;
});
}());
_syncAll(gestures);
if (!widget.excludeFromSemantics) {
final RenderSemanticsGestureHandler semanticsGestureHandler = context.findRenderObject();
......@@ -554,7 +554,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
);
}
return true;
});
}());
if (!widget.excludeFromSemantics) {
final RenderSemanticsGestureHandler semanticsGestureHandler = context.findRenderObject();
semanticsGestureHandler.validActions = actions;
......
......@@ -121,7 +121,7 @@ class Hero extends StatefulWidget {
);
}
return true;
});
}());
final _HeroState heroState = hero.state;
result[tag] = heroState;
}
......@@ -310,7 +310,7 @@ class _HeroFlight {
case _HeroFlightType.push:
return initial.value == 0.0 && initial.status == AnimationStatus.forward;
}
});
}());
manifest = initialManifest;
......
......@@ -173,7 +173,7 @@ class _RenderLayoutBuilder extends RenderBox with RenderObjectWithChildMixin<Ren
);
}
return true;
});
}());
return true;
}
......
......@@ -718,7 +718,7 @@ class Navigator extends StatefulWidget {
);
}
return true;
});
}());
return navigator;
}
......@@ -779,7 +779,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
),
);
return true;
});
}());
push(_routeNamed(Navigator.defaultRouteName));
} else {
for (Route<dynamic> route in plannedInitialRoutes)
......@@ -813,7 +813,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
@override
void dispose() {
assert(!_debugLocked);
assert(() { _debugLocked = true; return true; });
assert(() { _debugLocked = true; return true; }());
for (NavigatorObserver observer in widget.observers)
observer._navigator = null;
final List<Route<dynamic>> doomed = _poppedRoutes.toList()..addAll(_history);
......@@ -823,7 +823,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
_history.clear();
focusScopeNode.detach();
super.dispose();
assert(() { _debugLocked = false; return true; });
assert(() { _debugLocked = false; return true; }());
}
/// The overlay this navigator uses for its visual presentation.
......@@ -859,7 +859,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
);
}
return true;
});
}());
route = widget.onUnknownRoute(settings);
assert(() {
if (route == null) {
......@@ -872,7 +872,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
);
}
return true;
});
}());
}
return route;
}
......@@ -908,7 +908,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
/// when the pushed route is popped off the navigator.
Future<dynamic> push(Route<dynamic> route) {
assert(!_debugLocked);
assert(() { _debugLocked = true; return true; });
assert(() { _debugLocked = true; return true; }());
assert(route != null);
assert(route._navigator == null);
setState(() {
......@@ -923,7 +923,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
for (NavigatorObserver observer in widget.observers)
observer.didPush(route, oldRoute);
});
assert(() { _debugLocked = false; return true; });
assert(() { _debugLocked = false; return true; }());
_cancelActivePointers();
return route.popped;
}
......@@ -942,7 +942,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
assert(newRoute != null);
if (oldRoute == newRoute)
return;
assert(() { _debugLocked = true; return true; });
assert(() { _debugLocked = true; return true; }());
assert(oldRoute._navigator == this);
assert(newRoute._navigator == null);
assert(oldRoute.overlayEntries.isNotEmpty);
......@@ -965,7 +965,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
_history[index - 1].didChangeNext(newRoute);
oldRoute.dispose();
});
assert(() { _debugLocked = false; return true; });
assert(() { _debugLocked = false; return true; }());
}
/// Push the [newRoute] and dispose the old current Route.
......@@ -980,7 +980,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
/// as if the old route had been popped.
Future<dynamic> pushReplacement(Route<dynamic> newRoute, { dynamic result }) {
assert(!_debugLocked);
assert(() { _debugLocked = true; return true; });
assert(() { _debugLocked = true; return true; }());
final Route<dynamic> oldRoute = _history.last;
assert(oldRoute != null && oldRoute._navigator == this);
assert(oldRoute.overlayEntries.isNotEmpty);
......@@ -1008,7 +1008,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
for (NavigatorObserver observer in widget.observers)
observer.didPush(newRoute, oldRoute);
});
assert(() { _debugLocked = false; return true; });
assert(() { _debugLocked = false; return true; }());
_cancelActivePointers();
return newRoute.popped;
}
......@@ -1047,7 +1047,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
/// [Route.didChangePrevious]). The navigator observer is not notified.
void removeRouteBelow(Route<dynamic> anchorRoute) {
assert(!_debugLocked);
assert(() { _debugLocked = true; return true; });
assert(() { _debugLocked = true; return true; }());
assert(anchorRoute._navigator == this);
final int index = _history.indexOf(anchorRoute) - 1;
assert(index >= 0);
......@@ -1064,7 +1064,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
nextRoute.didChangePrevious(previousRoute);
targetRoute.dispose();
});
assert(() { _debugLocked = false; return true; });
assert(() { _debugLocked = false; return true; }());
}
/// Push the given route and then remove all the previous routes until the
......@@ -1080,7 +1080,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
/// that always returns false.
Future<dynamic> pushAndRemoveUntil(Route<dynamic> newRoute, RoutePredicate predicate) {
assert(!_debugLocked);
assert(() { _debugLocked = true; return true; });
assert(() { _debugLocked = true; return true; }());
final List<Route<dynamic>> removedRoutes = <Route<dynamic>>[];
while (_history.isNotEmpty && !predicate(_history.last)) {
final Route<dynamic> removedRoute = _history.removeLast();
......@@ -1107,7 +1107,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
for (NavigatorObserver observer in widget.observers)
observer.didPush(newRoute, oldRoute);
});
assert(() { _debugLocked = false; return true; });
assert(() { _debugLocked = false; return true; }());
_cancelActivePointers();
return newRoute.popped;
}
......@@ -1167,11 +1167,11 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
/// popped.
bool pop([dynamic result]) {
assert(!_debugLocked);
assert(() { _debugLocked = true; return true; });
assert(() { _debugLocked = true; return true; }());
final Route<dynamic> route = _history.last;
assert(route._navigator == this);
bool debugPredictedWouldPop;
assert(() { debugPredictedWouldPop = !route.willHandlePopInternally; return true; });
assert(() { debugPredictedWouldPop = !route.willHandlePopInternally; return true; }());
if (route.didPop(result ?? route.currentResult)) {
assert(debugPredictedWouldPop);
if (_history.length > 1) {
......@@ -1190,13 +1190,13 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
observer.didPop(route, _history.last);
});
} else {
assert(() { _debugLocked = false; return true; });
assert(() { _debugLocked = false; return true; }());
return false;
}
} else {
assert(!debugPredictedWouldPop);
}
assert(() { _debugLocked = false; return true; });
assert(() { _debugLocked = false; return true; }());
_cancelActivePointers();
return true;
}
......@@ -1213,7 +1213,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
void removeRoute(Route<dynamic> route) {
assert(route != null);
assert(!_debugLocked);
assert(() { _debugLocked = true; return true; });
assert(() { _debugLocked = true; return true; }());
assert(route._navigator == this);
final int index = _history.indexOf(route);
assert(index != -1);
......@@ -1227,7 +1227,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
observer.didRemove(route, previousRoute);
route.dispose();
});
assert(() { _debugLocked = false; return true; });
assert(() { _debugLocked = false; return true; }());
_cancelActivePointers();
}
......
......@@ -251,7 +251,7 @@ class Overlay extends StatefulWidget {
);
}
return true;
});
}());
return result;
}
......@@ -331,7 +331,7 @@ class OverlayState extends State<Overlay> with TickerProviderStateMixin {
break;
}
return true;
});
}());
return result;
}
......
......@@ -369,7 +369,7 @@ class ClampingScrollPhysics extends ScrollPhysics {
);
}
return true;
});
}());
if (value < position.pixels && position.pixels <= position.minScrollExtent) // underscroll
return value - position.pixels;
if (position.maxScrollExtent <= position.pixels && position.pixels < value) // overscroll
......
......@@ -209,7 +209,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
);
}
return true;
});
}());
final double oldPixels = _pixels;
_pixels = newPixels - overscroll;
if (_pixels != oldPixels) {
......@@ -351,7 +351,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
);
}
return true;
});
}());
return result;
}
......
......@@ -842,7 +842,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
assert(slot == childParentData.index);
return true;
});
}());
}
@override
......
......@@ -111,7 +111,7 @@ class Table extends RenderObjectWidget {
);
}
return true;
}),
}()),
assert(() {
if (children.any((TableRow row1) => row1.key != null && children.any((TableRow row2) => row1 != row2 && row1.key == row2.key))) {
throw new FlutterError(
......@@ -120,7 +120,7 @@ class Table extends RenderObjectWidget {
);
}
return true;
}),
}()),
assert(() {
if (children.isNotEmpty) {
final int cellCount = children.first.children.length;
......@@ -133,7 +133,7 @@ class Table extends RenderObjectWidget {
}
}
return true;
}),
}()),
_rowDecorations = children.any((TableRow row) => row.decoration != null)
? children.map<Decoration>((TableRow row) => row.decoration).toList(growable: false)
: null,
......@@ -149,7 +149,7 @@ class Table extends RenderObjectWidget {
);
}
return true;
});
}());
}
/// The rows of the table.
......@@ -243,7 +243,7 @@ class _TableElement extends RenderObjectElement {
void mount(Element parent, dynamic newSlot) {
super.mount(parent, newSlot);
assert(!_debugWillReattachChildren);
assert(() { _debugWillReattachChildren = true; return true; });
assert(() { _debugWillReattachChildren = true; return true; }());
_children = widget.children.map((TableRow row) {
return new _TableElementRow(
key: row.key,
......@@ -253,7 +253,7 @@ class _TableElement extends RenderObjectElement {
}).toList(growable: false)
);
}).toList(growable: false);
assert(() { _debugWillReattachChildren = false; return true; });
assert(() { _debugWillReattachChildren = false; return true; }());
_updateRenderObjectChildren();
}
......@@ -278,7 +278,7 @@ class _TableElement extends RenderObjectElement {
return true;
}
return false;
});
}());
final TableCellParentData childParentData = child.parentData;
renderObject.setChild(childParentData.x, childParentData.y, null);
}
......@@ -288,7 +288,7 @@ class _TableElement extends RenderObjectElement {
@override
void update(Table newWidget) {
assert(!_debugWillReattachChildren);
assert(() { _debugWillReattachChildren = true; return true; });
assert(() { _debugWillReattachChildren = true; return true; }());
final Map<LocalKey, List<Element>> oldKeyedRows = new Map<LocalKey, List<Element>>.fromIterable(
_children.where((_TableElementRow row) => row.key != null),
key: (_TableElementRow row) => row.key,
......@@ -316,7 +316,7 @@ class _TableElement extends RenderObjectElement {
updateChildren(oldUnkeyedRows.current.children, const <Widget>[], forgottenChildren: _forgottenChildren);
for (List<Element> oldChildren in oldKeyedRows.values.where((List<Element> list) => !taken.contains(list)))
updateChildren(oldChildren, const <Widget>[], forgottenChildren: _forgottenChildren);
assert(() { _debugWillReattachChildren = false; return true; });
assert(() { _debugWillReattachChildren = false; return true; }());
_children = newChildren;
_updateRenderObjectChildren();
_forgottenChildren.clear();
......
......@@ -92,7 +92,7 @@ abstract class SingleTickerProviderStateMixin extends State<dynamic> implements
'objects and those objects might use it more than one time in total, then instead of '
'mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.'
);
});
}());
_ticker = new Ticker(onTick, debugLabel: 'created by $this');
// We assume that this is called from initState, build, or some sort of
// event handler, and that thus TickerMode.of(context) would return true. We
......@@ -115,7 +115,7 @@ abstract class SingleTickerProviderStateMixin extends State<dynamic> implements
'Otherwise, the ticker will leak.\n'
'The offending ticker was: ${_ticker.toString(debugIncludeStack: true)}'
);
});
}());
super.dispose();
}
......@@ -195,7 +195,7 @@ abstract class TickerProviderStateMixin extends State<dynamic> implements Ticker
}
}
return true;
});
}());
super.dispose();
}
......
......@@ -406,7 +406,7 @@ class _InspectorOverlayLayer extends Layer {
assert(() {
inDebugMode = true;
return true;
});
}());
if (inDebugMode == false) {
throw new FlutterError(
'The inspector should never be used in production mode due to the '
......
......@@ -115,7 +115,7 @@ Future<Null> benchmarkWidgets(WidgetTesterCallback callback) {
print('│ ');
print('└─────────────────────────────────────────────────╌┄┈ 🐢');
return true;
});
}());
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
assert(binding is! AutomatedTestWidgetsFlutterBinding);
final WidgetTester tester = new WidgetTester._(binding);
......
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