Remove unnecessary null checks in dev/benchmarks (#118840)

* Remove unnecessary null checks in dev/benchmarks

* empty
This commit is contained in:
Michael Goderbauer
2023-01-19 20:04:11 -08:00
committed by GitHub
parent ec51d3271e
commit 54217bd4b1
13 changed files with 18 additions and 69 deletions

View File

@@ -159,9 +159,7 @@ class _Tester {
final Stopwatch stopwatch = Stopwatch()..start();
await gesture.moveTo(location, timeStamp: currentTime);
stopwatch.stop();
if (onDataPoint != null) {
onDataPoint(stopwatch.elapsed);
}
onDataPoint(stopwatch.elapsed);
await _UntilNextFrame.wait();
}

View File

@@ -181,9 +181,7 @@ class _Tester {
final Stopwatch stopwatch = Stopwatch()..start();
await gesture.moveTo(location, timeStamp: currentTime);
stopwatch.stop();
if (onDataPoint != null) {
onDataPoint(stopwatch.elapsed);
}
onDataPoint(stopwatch.elapsed);
await _UntilNextFrame.wait();
}

View File

@@ -340,9 +340,7 @@ class ColorItem extends StatelessWidget {
required this.index,
required this.color,
this.prefix = '',
}) : assert(index != null),
assert(color != null),
assert(prefix != null);
});
final int index;
final Color color;

View File

@@ -841,8 +841,7 @@ class Profile {
/// If [useCustomWarmUp] is true the benchmark will continue running until
/// [stopBenchmark] is called. Otherwise, the benchmark collects the
/// [kDefaultTotalSampleCount] samples and stops automatically.
Profile({required this.name, this.useCustomWarmUp = false})
: assert(name != null);
Profile({required this.name, this.useCustomWarmUp = false});
/// The name of the benchmark that produced this profile.
final String name;
@@ -1296,13 +1295,6 @@ final Map<String, EngineBenchmarkValueListener> _engineBenchmarkListeners = <Str
///
/// If another listener is already registered, overrides it.
void registerEngineBenchmarkValueListener(String name, EngineBenchmarkValueListener listener) {
if (listener == null) {
throw ArgumentError(
'Listener must not be null. To stop listening to engine benchmark values '
'under label "$name", call stopListeningToEngineBenchmarkValues(\'$name\').',
);
}
if (_engineBenchmarkListeners.containsKey(name)) {
throw StateError(
'A listener for "$name" is already registered.\n'