mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
use bool in assert (#12170)
This commit is contained in:
parent
cde6b669b3
commit
2958d7d0fc
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -101,7 +101,7 @@ class PaintingContext {
|
||||
includedChild: true,
|
||||
);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
if (child._layer == null) {
|
||||
assert(debugAlsoPaintedParent);
|
||||
child._layer = new OffsetLayer();
|
||||
@ -112,7 +112,7 @@ class PaintingContext {
|
||||
assert(() {
|
||||
child._layer.debugCreator = child.debugCreator ?? child.runtimeType;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
final PaintingContext childContext = new PaintingContext._(child._layer, child.paintBounds);
|
||||
child._paintWithContext(childContext, Offset.zero);
|
||||
childContext._stopRecordingIfNeeded();
|
||||
@ -128,7 +128,7 @@ class PaintingContext {
|
||||
if (debugProfilePaintsEnabled)
|
||||
Timeline.startSync('${child.runtimeType}', arguments: timelineWhitelistArguments);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
|
||||
if (child.isRepaintBoundary) {
|
||||
_stopRecordingIfNeeded();
|
||||
@ -141,7 +141,7 @@ class PaintingContext {
|
||||
if (debugProfilePaintsEnabled)
|
||||
Timeline.finishSync();
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
void _compositeChild(RenderObject child, Offset offset) {
|
||||
@ -162,7 +162,7 @@ class PaintingContext {
|
||||
);
|
||||
child._layer.debugCreator = child.debugCreator ?? child;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
child._layer.offset = offset;
|
||||
_appendLayer(child._layer);
|
||||
@ -187,7 +187,7 @@ class PaintingContext {
|
||||
assert(_canvas == null);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return hasCanvas;
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ class PaintingContext {
|
||||
canvas.drawRect(canvasBounds, paint);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
_currentLayer.picture = _recorder.endRecording();
|
||||
_currentLayer = null;
|
||||
_recorder = null;
|
||||
@ -633,7 +633,7 @@ abstract class _SemanticsFragment {
|
||||
for (_SemanticsFragment child in children)
|
||||
assert(seenChildren.add(child)); // check for duplicate adds
|
||||
return true;
|
||||
}),
|
||||
}()),
|
||||
_ancestorChain = <RenderObject>[renderObjectOwner],
|
||||
_children = children ?? const <_SemanticsFragment>[];
|
||||
|
||||
@ -691,7 +691,7 @@ class _CleanSemanticsFragment extends _SemanticsFragment {
|
||||
@override
|
||||
Iterable<SemanticsNode> compile({ _SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics }) sync* {
|
||||
assert(!_debugCompiled);
|
||||
assert(() { _debugCompiled = true; return true; });
|
||||
assert(() { _debugCompiled = true; return true; }());
|
||||
final SemanticsNode node = renderObjectOwner._semantics;
|
||||
assert(node != null);
|
||||
if (geometry != null) {
|
||||
@ -715,7 +715,7 @@ abstract class _InterestingSemanticsFragment extends _SemanticsFragment {
|
||||
@override
|
||||
Iterable<SemanticsNode> compile({ _SemanticsGeometry geometry, SemanticsNode currentSemantics, SemanticsNode parentSemantics }) sync* {
|
||||
assert(!_debugCompiled);
|
||||
assert(() { _debugCompiled = true; return true; });
|
||||
assert(() { _debugCompiled = true; return true; }());
|
||||
final SemanticsNode node = establishSemanticsNode(geometry, currentSemantics, parentSemantics);
|
||||
final List<SemanticsNode> children = <SemanticsNode>[];
|
||||
for (_SemanticsFragment child in _children) {
|
||||
@ -906,7 +906,7 @@ class _ForkingSemanticsFragment extends _SemanticsFragment {
|
||||
SemanticsNode parentSemantics
|
||||
}) sync* {
|
||||
assert(!_debugCompiled);
|
||||
assert(() { _debugCompiled = true; return true; });
|
||||
assert(() { _debugCompiled = true; return true; }());
|
||||
assert(geometry != null);
|
||||
geometry.applyAncestorChain(_ancestorChain);
|
||||
for (_SemanticsFragment child in _children) {
|
||||
@ -964,7 +964,7 @@ class SemanticsHandle {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
if (_owner != null) {
|
||||
if (listener != null)
|
||||
_owner.semanticsOwner.removeListener(listener);
|
||||
@ -1235,7 +1235,7 @@ class PipelineOwner {
|
||||
return;
|
||||
Timeline.startSync('Semantics');
|
||||
assert(_semanticsOwner != null);
|
||||
assert(() { _debugDoingSemantics = true; return true; });
|
||||
assert(() { _debugDoingSemantics = true; return true; }());
|
||||
try {
|
||||
final List<RenderObject> nodesToProcess = _nodesNeedingSemantics.toList()
|
||||
..sort((RenderObject a, RenderObject b) => a.depth - b.depth);
|
||||
@ -1247,7 +1247,7 @@ class PipelineOwner {
|
||||
_semanticsOwner.sendSemanticsUpdate();
|
||||
} finally {
|
||||
assert(_nodesNeedingSemantics.isEmpty);
|
||||
assert(() { _debugDoingSemantics = false; return true; });
|
||||
assert(() { _debugDoingSemantics = false; return true; }());
|
||||
Timeline.finishSync();
|
||||
}
|
||||
}
|
||||
@ -1562,7 +1562,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
node = node.parent;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1611,7 +1611,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
assert(() {
|
||||
result = _needsLayout;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return result;
|
||||
}
|
||||
bool _needsLayout = true;
|
||||
@ -1710,7 +1710,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
if (debugPrintMarkNeedsLayoutStacks)
|
||||
debugPrintStack(label: 'markNeedsLayout() called for $this');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
owner._nodesNeedingLayout.add(this);
|
||||
owner.requestVisualUpdate();
|
||||
}
|
||||
@ -1775,7 +1775,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
assert(() {
|
||||
_debugCanParentUseSize = false;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
owner._nodesNeedingLayout.add(this);
|
||||
}
|
||||
|
||||
@ -1793,7 +1793,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
if (debugPrintLayouts)
|
||||
debugPrint('Laying out (without resize) $this');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
try {
|
||||
performLayout();
|
||||
markNeedsSemanticsUpdate();
|
||||
@ -1805,7 +1805,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
_debugDoingThisLayout = false;
|
||||
_debugMutationsLocked = false;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
_needsLayout = false;
|
||||
markNeedsPaint();
|
||||
}
|
||||
@ -1875,7 +1875,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
assert(() {
|
||||
_debugCanParentUseSize = parentUsesSize;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
if (!_needsLayout && constraints == _constraints && relayoutBoundary == _relayoutBoundary) {
|
||||
assert(() {
|
||||
// in case parentUsesSize changed since the last invocation, set size
|
||||
@ -1889,7 +1889,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
_debugDoingThisLayout = false;
|
||||
_debugDoingThisResize = false;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return;
|
||||
}
|
||||
_constraints = constraints;
|
||||
@ -1901,16 +1901,16 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
if (debugPrintLayouts)
|
||||
debugPrint('Laying out (${sizedByParent ? "with separate resize" : "with resize allowed"}) $this');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
if (sizedByParent) {
|
||||
assert(() { _debugDoingThisResize = true; return true; });
|
||||
assert(() { _debugDoingThisResize = true; return true; }());
|
||||
try {
|
||||
performResize();
|
||||
assert(() { debugAssertDoesMeetConstraints(); return true; });
|
||||
assert(() { debugAssertDoesMeetConstraints(); return true; }());
|
||||
} catch (e, stack) {
|
||||
_debugReportException('performResize', e, stack);
|
||||
}
|
||||
assert(() { _debugDoingThisResize = false; return true; });
|
||||
assert(() { _debugDoingThisResize = false; return true; }());
|
||||
}
|
||||
RenderObject debugPreviousActiveLayout;
|
||||
assert(() {
|
||||
@ -1918,11 +1918,11 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
debugPreviousActiveLayout = _debugActiveLayout;
|
||||
_debugActiveLayout = this;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
try {
|
||||
performLayout();
|
||||
markNeedsSemanticsUpdate();
|
||||
assert(() { debugAssertDoesMeetConstraints(); return true; });
|
||||
assert(() { debugAssertDoesMeetConstraints(); return true; }());
|
||||
} catch (e, stack) {
|
||||
_debugReportException('performLayout', e, stack);
|
||||
}
|
||||
@ -1931,7 +1931,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
_debugDoingThisLayout = false;
|
||||
_debugMutationsLocked = false;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
_needsLayout = false;
|
||||
markNeedsPaint();
|
||||
}
|
||||
@ -2112,7 +2112,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
assert(() {
|
||||
result = _layer;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -2147,7 +2147,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
if (parent is RenderObject)
|
||||
return parent._needsCompositing;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
// parent is fine (or there isn't one), but we are dirty
|
||||
if (owner != null)
|
||||
owner._nodesNeedingCompositingBitsUpdate.add(this);
|
||||
@ -2199,7 +2199,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
assert(() {
|
||||
result = _needsPaint;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return result;
|
||||
}
|
||||
bool _needsPaint = true;
|
||||
@ -2228,7 +2228,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
if (debugPrintMarkNeedsPaintStacks)
|
||||
debugPrintStack(label: 'markNeedsPaint() called for $this');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
// If we always have our own layer, then we can just repaint
|
||||
// ourselves without involving any other nodes.
|
||||
assert(_layer != null);
|
||||
@ -2249,7 +2249,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
if (debugPrintMarkNeedsPaintStacks)
|
||||
debugPrintStack(label: 'markNeedsPaint() called for $this (root of render tree)');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
// If we're the root of the render tree (probably a RenderView),
|
||||
// then we have to paint ourselves, since nobody else can paint
|
||||
// us. We don't add ourselves to _nodesNeedingPaint in this
|
||||
@ -2332,7 +2332,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
// If we still need layout, then that means that we were skipped in the
|
||||
// layout phase and therefore don't need painting. We might not know that
|
||||
// yet (that is, our layer might not have been detached yet), because the
|
||||
@ -2357,7 +2357,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
RenderObject debugLastActivePaint;
|
||||
assert(() {
|
||||
_debugDoingThisPaint = true;
|
||||
@ -2365,7 +2365,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
_debugActivePaint = this;
|
||||
assert(!isRepaintBoundary || _layer != null);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
_needsPaint = false;
|
||||
try {
|
||||
paint(context, offset);
|
||||
@ -2379,7 +2379,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
_debugActivePaint = debugLastActivePaint;
|
||||
_debugDoingThisPaint = false;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
/// The bounds within which this render object will paint.
|
||||
@ -2534,7 +2534,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
assert(() {
|
||||
result = _semantics;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -2947,7 +2947,7 @@ abstract class RenderObjectWithChildMixin<ChildType extends RenderObject> extend
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3084,7 +3084,7 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -197,7 +197,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
|
||||
_debugIllFatedElements.add(_registry[this]);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
_registry[this] = element;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
|
||||
assert(element.widget.runtimeType != _registry[this].widget.runtimeType);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
if (_registry[this] == element) {
|
||||
_registry.remove(this);
|
||||
_removedKeys.add(this);
|
||||
@ -246,7 +246,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
|
||||
}
|
||||
_debugReservations[this] = parent;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
static void _debugVerifyIllFatedPopulation() {
|
||||
@ -280,7 +280,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
|
||||
throw new FlutterError(buffer.toString());
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
Element get _currentElement => _registry[this];
|
||||
@ -1158,7 +1158,7 @@ abstract class State<T extends StatefulWidget> extends Diagnosticable {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
final dynamic result = fn() as dynamic;
|
||||
assert(() {
|
||||
if (result is Future) {
|
||||
@ -1174,7 +1174,7 @@ abstract class State<T extends StatefulWidget> extends Diagnosticable {
|
||||
// We ignore other types of return values so that you can do things like:
|
||||
// setState(() => x = 3);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
_element.markNeedsBuild();
|
||||
}
|
||||
|
||||
@ -1230,7 +1230,7 @@ abstract class State<T extends StatefulWidget> extends Diagnosticable {
|
||||
@mustCallSuper
|
||||
void dispose() {
|
||||
assert(_debugLifecycleState == _StateLifecycle.ready);
|
||||
assert(() { _debugLifecycleState = _StateLifecycle.defunct; return true; });
|
||||
assert(() { _debugLifecycleState = _StateLifecycle.defunct; return true; }());
|
||||
}
|
||||
|
||||
/// Describes the part of the user interface represented by this widget.
|
||||
@ -1374,7 +1374,7 @@ abstract class State<T extends StatefulWidget> extends Diagnosticable {
|
||||
assert(() {
|
||||
description.add(new EnumProperty<_StateLifecycle>('lifecycle state', _debugLifecycleState, defaultValue: _StateLifecycle.ready));
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
description.add(new ObjectFlagProperty<T>('_widget', _widget, ifNull: 'no widget'));
|
||||
description.add(new ObjectFlagProperty<StatefulElement>('_element', _element, ifNull: 'not mounted'));
|
||||
}
|
||||
@ -1737,7 +1737,7 @@ class _InactiveElements {
|
||||
debugPrint('Discarding $element from inactive elements list.');
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
element.visitChildren((Element child) {
|
||||
assert(child._parent == element);
|
||||
_unmount(child);
|
||||
@ -1764,7 +1764,7 @@ class _InactiveElements {
|
||||
element.deactivate();
|
||||
assert(element._debugLifecycleState == _ElementLifecycle.inactive);
|
||||
element.visitChildren(_deactivateRecursively);
|
||||
assert(() { element.debugDeactivated(); return true; });
|
||||
assert(() { element.debugDeactivated(); return true; }());
|
||||
}
|
||||
|
||||
void add(Element element) {
|
||||
@ -1789,7 +1789,7 @@ class _InactiveElements {
|
||||
assert(() {
|
||||
result = _elements.contains(element);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -2128,7 +2128,7 @@ class BuildOwner {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
if (element._inDirtyList) {
|
||||
assert(() {
|
||||
if (debugPrintScheduleBuildForStacks)
|
||||
@ -2141,7 +2141,7 @@ class BuildOwner {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
_dirtyElementsNeedsResorting = true;
|
||||
return;
|
||||
}
|
||||
@ -2155,7 +2155,7 @@ class BuildOwner {
|
||||
if (debugPrintScheduleBuildForStacks)
|
||||
debugPrint('...dirty list is now: $_dirtyElements');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
int _debugStateLockLevel = 0;
|
||||
@ -2174,14 +2174,14 @@ class BuildOwner {
|
||||
assert(() {
|
||||
_debugStateLockLevel += 1;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
try {
|
||||
callback();
|
||||
} finally {
|
||||
assert(() {
|
||||
_debugStateLockLevel -= 1;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
assert(_debugStateLockLevel >= 0);
|
||||
}
|
||||
@ -2223,7 +2223,7 @@ class BuildOwner {
|
||||
_debugStateLockLevel += 1;
|
||||
_debugBuilding = true;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
Timeline.startSync('Build', arguments: timelineWhitelistArguments);
|
||||
try {
|
||||
_scheduledFlushDirtyElements = true;
|
||||
@ -2235,7 +2235,7 @@ class BuildOwner {
|
||||
debugPreviousBuildTarget = _debugCurrentBuildTarget;
|
||||
_debugCurrentBuildTarget = context;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
_dirtyElementsNeedsResorting = false;
|
||||
try {
|
||||
callback();
|
||||
@ -2246,7 +2246,7 @@ class BuildOwner {
|
||||
_debugCurrentBuildTarget = debugPreviousBuildTarget;
|
||||
_debugElementWasRebuilt(context);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
}
|
||||
_dirtyElements.sort(Element._sort);
|
||||
@ -2295,7 +2295,7 @@ class BuildOwner {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
} finally {
|
||||
for (Element element in _dirtyElements) {
|
||||
assert(element._inDirtyList);
|
||||
@ -2312,7 +2312,7 @@ class BuildOwner {
|
||||
if (debugPrintBuildScope)
|
||||
debugPrint('buildScope finished');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
assert(_debugStateLockLevel >= 0);
|
||||
}
|
||||
@ -2423,7 +2423,7 @@ class BuildOwner {
|
||||
_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans?.clear();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
} catch (e, stack) {
|
||||
_debugReportException('while finalizing the widget tree', e, stack);
|
||||
} finally {
|
||||
@ -2631,7 +2631,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
'so the children might not be constructed yet, or might be old children '
|
||||
'that are going to be replaced.'
|
||||
);
|
||||
});
|
||||
}());
|
||||
visitChildren(visitor);
|
||||
}
|
||||
|
||||
@ -2674,7 +2674,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
key._debugReserveFor(this);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
if (newWidget == null) {
|
||||
if (child != null)
|
||||
deactivateChild(child);
|
||||
@ -2694,7 +2694,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
assert(() {
|
||||
child.owner._debugElementWasRebuilt(child);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return child;
|
||||
}
|
||||
deactivateChild(child);
|
||||
@ -2732,7 +2732,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
key._register(this);
|
||||
}
|
||||
_updateInheritance();
|
||||
assert(() { _debugLifecycleState = _ElementLifecycle.active; return true; });
|
||||
assert(() { _debugLifecycleState = _ElementLifecycle.active; return true; }());
|
||||
}
|
||||
|
||||
/// Change the widget used to configure this element.
|
||||
@ -2838,7 +2838,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
if (debugPrintGlobalKeyedWidgetLifecycle)
|
||||
debugPrint('Attempting to take $element from ${element._parent ?? "inactive elements list"} to put in $this.');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
final Element parent = element._parent;
|
||||
if (parent != null) {
|
||||
assert(() {
|
||||
@ -2857,7 +2857,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
key,
|
||||
);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
parent.forgetChild(element);
|
||||
parent.deactivateChild(element);
|
||||
}
|
||||
@ -2888,7 +2888,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
final Element newChild = _retakeInactiveElement(key, newWidget);
|
||||
if (newChild != null) {
|
||||
assert(newChild._parent == null);
|
||||
assert(() { _debugCheckForCycles(newChild); return true; });
|
||||
assert(() { _debugCheckForCycles(newChild); return true; }());
|
||||
newChild._activateWithParent(this, newSlot);
|
||||
final Element updatedChild = updateChild(newChild, newWidget, newSlot);
|
||||
assert(newChild == updatedChild);
|
||||
@ -2896,7 +2896,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
}
|
||||
}
|
||||
final Element newChild = newWidget.createElement();
|
||||
assert(() { _debugCheckForCycles(newChild); return true; });
|
||||
assert(() { _debugCheckForCycles(newChild); return true; }());
|
||||
newChild.mount(this, newSlot);
|
||||
assert(newChild._debugLifecycleState == _ElementLifecycle.active);
|
||||
return newChild;
|
||||
@ -2910,7 +2910,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
node = node._parent;
|
||||
assert(node != newChild); // indicates we are about to create a cycle
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
/// Move the given element to the list of inactive elements and detach its
|
||||
@ -2940,7 +2940,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
debugPrint('Deactivated $child (keyed child of $this)');
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
/// Remove the given child from the element's child list, in preparation for
|
||||
@ -2961,7 +2961,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
if (debugPrintGlobalKeyedWidgetLifecycle)
|
||||
debugPrint('Reactivating $this (now child of $_parent).');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
_updateDepth(_parent.depth);
|
||||
_activateRecursively(this);
|
||||
attachRenderObject(newSlot);
|
||||
@ -2997,7 +2997,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
_dependencies?.clear();
|
||||
_hadUnsatisfiedDependencies = false;
|
||||
_updateInheritance();
|
||||
assert(() { _debugLifecycleState = _ElementLifecycle.active; return true; });
|
||||
assert(() { _debugLifecycleState = _ElementLifecycle.active; return true; }());
|
||||
if (_dirty)
|
||||
owner.scheduleBuildFor(this);
|
||||
if (hadDependencies)
|
||||
@ -3034,7 +3034,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
}
|
||||
_inheritedWidgets = null;
|
||||
_active = false;
|
||||
assert(() { _debugLifecycleState = _ElementLifecycle.inactive; return true; });
|
||||
assert(() { _debugLifecycleState = _ElementLifecycle.inactive; return true; }());
|
||||
}
|
||||
|
||||
/// Called, in debug mode, after children have been deactivated (see [deactivate]).
|
||||
@ -3066,7 +3066,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
final GlobalKey key = widget.key;
|
||||
key._unregister(this);
|
||||
}
|
||||
assert(() { _debugLifecycleState = _ElementLifecycle.defunct; return true; });
|
||||
assert(() { _debugLifecycleState = _ElementLifecycle.defunct; return true; }());
|
||||
}
|
||||
|
||||
@override
|
||||
@ -3105,7 +3105,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
final RenderObject renderObject = findRenderObject();
|
||||
assert(() {
|
||||
if (renderObject == null) {
|
||||
@ -3180,7 +3180,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
if (renderObject is RenderBox)
|
||||
return renderObject.size;
|
||||
return null;
|
||||
@ -3202,13 +3202,13 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
InheritedWidget inheritFromWidgetOfExactType(Type targetType) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup);
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup());
|
||||
final InheritedElement ancestor = _inheritedWidgets == null ? null : _inheritedWidgets[targetType];
|
||||
if (ancestor != null) {
|
||||
assert(ancestor is InheritedElement);
|
||||
@ -3223,7 +3223,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
|
||||
@override
|
||||
InheritedElement ancestorInheritedElementForWidgetOfExactType(Type targetType) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup);
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup());
|
||||
final InheritedElement ancestor = _inheritedWidgets == null ? null : _inheritedWidgets[targetType];
|
||||
return ancestor;
|
||||
}
|
||||
@ -3235,7 +3235,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
|
||||
@override
|
||||
Widget ancestorWidgetOfExactType(Type targetType) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup);
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup());
|
||||
Element ancestor = _parent;
|
||||
while (ancestor != null && ancestor.widget.runtimeType != targetType)
|
||||
ancestor = ancestor._parent;
|
||||
@ -3244,7 +3244,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
|
||||
@override
|
||||
State ancestorStateOfType(TypeMatcher matcher) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup);
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup());
|
||||
Element ancestor = _parent;
|
||||
while (ancestor != null) {
|
||||
if (ancestor is StatefulElement && matcher.check(ancestor.state))
|
||||
@ -3257,7 +3257,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
|
||||
@override
|
||||
RenderObject ancestorRenderObjectOfType(TypeMatcher matcher) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup);
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup());
|
||||
Element ancestor = _parent;
|
||||
while (ancestor != null) {
|
||||
if (ancestor is RenderObjectElement && matcher.check(ancestor.renderObject))
|
||||
@ -3270,7 +3270,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
|
||||
@override
|
||||
void visitAncestorElements(bool visitor(Element element)) {
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup);
|
||||
assert(_debugCheckStateIsActiveForAncestorLoopkup());
|
||||
Element ancestor = _parent;
|
||||
while (ancestor != null && visitor(ancestor))
|
||||
ancestor = ancestor._parent;
|
||||
@ -3421,7 +3421,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
if (dirty)
|
||||
return;
|
||||
_dirty = true;
|
||||
@ -3445,7 +3445,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
assert(_debugLifecycleState == _ElementLifecycle.active);
|
||||
assert(owner._debugStateLocked);
|
||||
Element debugPreviousBuildTarget;
|
||||
@ -3453,13 +3453,13 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
debugPreviousBuildTarget = owner._debugCurrentBuildTarget;
|
||||
owner._debugCurrentBuildTarget = this;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
performRebuild();
|
||||
assert(() {
|
||||
assert(owner._debugCurrentBuildTarget == this);
|
||||
owner._debugCurrentBuildTarget = debugPreviousBuildTarget;
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
assert(!_dirty);
|
||||
}
|
||||
|
||||
@ -3548,7 +3548,7 @@ abstract class ComponentElement extends Element {
|
||||
if (debugProfileBuildsEnabled)
|
||||
Timeline.startSync('${widget.runtimeType}');
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
|
||||
assert(_debugSetAllowIgnoredCallsToMarkNeedsBuild(true));
|
||||
Widget built;
|
||||
@ -3577,7 +3577,7 @@ abstract class ComponentElement extends Element {
|
||||
if (debugProfileBuildsEnabled)
|
||||
Timeline.finishSync();
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
/// Subclasses should override this function to actually call the appropriate
|
||||
@ -3634,7 +3634,7 @@ class StatefulElement extends ComponentElement {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
assert(_state._element == null);
|
||||
_state._element = this;
|
||||
assert(_state._widget == null);
|
||||
@ -3668,9 +3668,9 @@ class StatefulElement extends ComponentElement {
|
||||
} finally {
|
||||
_debugSetAllowIgnoredCallsToMarkNeedsBuild(false);
|
||||
}
|
||||
assert(() { _state._debugLifecycleState = _StateLifecycle.initialized; return true; });
|
||||
assert(() { _state._debugLifecycleState = _StateLifecycle.initialized; return true; }());
|
||||
_state.didChangeDependencies();
|
||||
assert(() { _state._debugLifecycleState = _StateLifecycle.ready; return true; });
|
||||
assert(() { _state._debugLifecycleState = _StateLifecycle.ready; return true; }());
|
||||
super._firstBuild();
|
||||
}
|
||||
|
||||
@ -3721,7 +3721,7 @@ class StatefulElement extends ComponentElement {
|
||||
'dispose() implementations must always call their superclass dispose() method, to ensure '
|
||||
'that all the resources used by the widget are fully released.'
|
||||
);
|
||||
});
|
||||
}());
|
||||
_state._element = null;
|
||||
_state = null;
|
||||
}
|
||||
@ -3763,7 +3763,7 @@ class StatefulElement extends ComponentElement {
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
return super.inheritFromWidgetOfExactType(targetType);
|
||||
}
|
||||
|
||||
@ -3845,7 +3845,7 @@ class ParentDataElement<T extends RenderObjectWidget> extends ProxyElement {
|
||||
badAncestors: badAncestors
|
||||
)
|
||||
);
|
||||
});
|
||||
}());
|
||||
super.mount(parent, slot);
|
||||
}
|
||||
|
||||
@ -3932,7 +3932,7 @@ class InheritedElement extends ProxyElement {
|
||||
assert(() {
|
||||
assert(_dependents.isEmpty);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
super.debugDeactivated();
|
||||
}
|
||||
|
||||
@ -3959,7 +3959,7 @@ class InheritedElement extends ProxyElement {
|
||||
while (ancestor != this && ancestor != null)
|
||||
ancestor = ancestor._parent;
|
||||
return ancestor == this;
|
||||
});
|
||||
}());
|
||||
// check that it really deepends on us
|
||||
assert(dependent._dependencies.contains(this));
|
||||
dependent.didChangeDependencies();
|
||||
@ -4168,7 +4168,7 @@ abstract class RenderObjectElement extends Element {
|
||||
void mount(Element parent, dynamic newSlot) {
|
||||
super.mount(parent, newSlot);
|
||||
_renderObject = widget.createRenderObject(this);
|
||||
assert(() { _debugUpdateRenderObjectOwner(); return true; });
|
||||
assert(() { _debugUpdateRenderObjectOwner(); return true; }());
|
||||
assert(_slot == newSlot);
|
||||
attachRenderObject(newSlot);
|
||||
_dirty = false;
|
||||
@ -4178,7 +4178,7 @@ abstract class RenderObjectElement extends Element {
|
||||
void update(covariant RenderObjectWidget newWidget) {
|
||||
super.update(newWidget);
|
||||
assert(widget == newWidget);
|
||||
assert(() { _debugUpdateRenderObjectOwner(); return true; });
|
||||
assert(() { _debugUpdateRenderObjectOwner(); return true; }());
|
||||
widget.updateRenderObject(this, renderObject);
|
||||
_dirty = false;
|
||||
}
|
||||
@ -4187,7 +4187,7 @@ abstract class RenderObjectElement extends Element {
|
||||
assert(() {
|
||||
_renderObject.debugCreator = new _DebugCreator(this);
|
||||
return true;
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user