Attempt to reduce usage of runtimeType (#31696)
This commit is contained in:
@@ -11,3 +11,23 @@
|
||||
/// a particular block of code will not be executed in release mode, and hence
|
||||
/// can be removed.
|
||||
const bool kReleaseMode = bool.fromEnvironment('dart.vm.product', defaultValue: false);
|
||||
|
||||
/// A constant that is true if the application was compiled in profile mode.
|
||||
///
|
||||
/// More specifically, this is a constant that is true if the application was
|
||||
/// compiled in Dart with the '-Ddart.vm.profile=true' flag.
|
||||
///
|
||||
/// Since this is a const value, it can be used to indicate to the compiler that
|
||||
/// a particular block of code will not be executed in profle mode, an hence
|
||||
/// can be removed.
|
||||
const bool kProfileMode = bool.fromEnvironment('dart.vm.profile', defaultValue: false);
|
||||
|
||||
/// A constant that is true if the application was compiled in debug mode.
|
||||
///
|
||||
/// More specifically, this is a constant that is true if the application was
|
||||
/// not compiled with '-Ddart.vm.product=true' and '-Ddart.vm.profile=true'.
|
||||
///
|
||||
/// Since this is a const value, it can be used to indicate to the compiler that
|
||||
/// a particular block of code will not be executed in debug mode, and hence
|
||||
/// can be removed.
|
||||
const bool kDebugMode = !kReleaseMode && !kProfileMode;
|
||||
|
||||
@@ -280,7 +280,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
duration: widget.duration,
|
||||
debugLabel: '${widget.toStringShort()}',
|
||||
debugLabel: kDebugMode ? '${widget.toStringShort()}' : null,
|
||||
vsync: this,
|
||||
);
|
||||
_updateCurve();
|
||||
|
||||
@@ -507,7 +507,7 @@ class BallisticScrollActivity extends ScrollActivity {
|
||||
TickerProvider vsync,
|
||||
) : super(delegate) {
|
||||
_controller = AnimationController.unbounded(
|
||||
debugLabel: '$runtimeType',
|
||||
debugLabel: kDebugMode ? '$runtimeType' : null,
|
||||
vsync: vsync,
|
||||
)
|
||||
..addListener(_tick)
|
||||
|
||||
@@ -90,7 +90,7 @@ mixin SingleTickerProviderStateMixin<T extends StatefulWidget> on State<T> imple
|
||||
'mixing in a SingleTickerProviderStateMixin, use a regular TickerProviderStateMixin.'
|
||||
);
|
||||
}());
|
||||
_ticker = Ticker(onTick, debugLabel: 'created by $this');
|
||||
_ticker = Ticker(onTick, debugLabel: kDebugMode ? 'created by $this' : null);
|
||||
// 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
|
||||
// can't actually check that here because if we're in initState then we're
|
||||
|
||||
@@ -281,8 +281,12 @@ class KernelCompiler {
|
||||
command.add('--aot');
|
||||
command.add('--tfa');
|
||||
}
|
||||
// If we're not targeting product (release) mode and we're still aot, then
|
||||
// target profile mode.
|
||||
if (targetProductVm) {
|
||||
command.add('-Ddart.vm.product=true');
|
||||
} else if (aot) {
|
||||
command.add('-Ddart.vm.profile=true');
|
||||
}
|
||||
if (incrementalCompilerByteStorePath != null) {
|
||||
command.add('--incremental');
|
||||
|
||||
Reference in New Issue
Block a user