From e39fa7a8365c3f141bd67ee7e31020c05356a7fa Mon Sep 17 00:00:00 2001 From: fzyzcjy <5236035+fzyzcjy@users.noreply.github.com> Date: Wed, 26 Oct 2022 07:31:14 +0800 Subject: [PATCH] Fix wasted memory caused by debug fields - 16 bytes per object (when adding that should-be-removed field crosses double-word alignment) (#113927) --- .../flutter/lib/src/animation/animation_controller.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/flutter/lib/src/animation/animation_controller.dart b/packages/flutter/lib/src/animation/animation_controller.dart index da359a0780e..73cd31c85e1 100644 --- a/packages/flutter/lib/src/animation/animation_controller.dart +++ b/packages/flutter/lib/src/animation/animation_controller.dart @@ -842,7 +842,13 @@ class AnimationController extends Animation String toStringDetails() { final String paused = isAnimating ? '' : '; paused'; final String ticker = _ticker == null ? '; DISPOSED' : (_ticker!.muted ? '; silenced' : ''); - final String label = debugLabel == null ? '' : '; for $debugLabel'; + String label = ''; + assert(() { + if (debugLabel != null) { + label = '; for $debugLabel'; + } + return true; + }()); final String more = '${super.toStringDetails()} ${value.toStringAsFixed(3)}'; return '$more$paused$ticker$label'; }