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