Use curly_braces_in_flow_control_structures for non-flutter packages (#104629)
* Use `curly_braces_in_flow_control_structures` for `packages/flutter_driver` * Use `curly_braces_in_flow_control_structures` for `packages/flutter_goldens` * Use `curly_braces_in_flow_control_structures` for `packages/flutter_goldens_client` * Use `curly_braces_in_flow_control_structures` for `packages/flutter_localizations` * Use `curly_braces_in_flow_control_structures` for `packages/flutter_test` * Use `curly_braces_in_flow_control_structures` for `packages/flutter_web_plugins` * fix comments * Use `curly_braces_in_flow_control_structures` for `packages/integration_test` * fix indentation
This commit is contained in:
@@ -410,23 +410,26 @@ class TimelineSummary {
|
||||
}
|
||||
|
||||
double _averageInMillis(Iterable<Duration> durations) {
|
||||
if (durations.isEmpty)
|
||||
if (durations.isEmpty) {
|
||||
throw ArgumentError('durations is empty!');
|
||||
}
|
||||
final double total = durations.fold<double>(0.0, (double t, Duration duration) => t + duration.inMicroseconds.toDouble() / 1000.0);
|
||||
return total / durations.length;
|
||||
}
|
||||
|
||||
double _percentileInMillis(Iterable<Duration> durations, double percentile) {
|
||||
if (durations.isEmpty)
|
||||
if (durations.isEmpty) {
|
||||
throw ArgumentError('durations is empty!');
|
||||
}
|
||||
assert(percentile >= 0.0 && percentile <= 100.0);
|
||||
final List<double> doubles = durations.map<double>((Duration duration) => duration.inMicroseconds.toDouble() / 1000.0).toList();
|
||||
return findPercentile(doubles, percentile);
|
||||
}
|
||||
|
||||
double _maxInMillis(Iterable<Duration> durations) {
|
||||
if (durations.isEmpty)
|
||||
if (durations.isEmpty) {
|
||||
throw ArgumentError('durations is empty!');
|
||||
}
|
||||
return durations
|
||||
.map<double>((Duration duration) => duration.inMicroseconds.toDouble() / 1000.0)
|
||||
.reduce(math.max);
|
||||
|
||||
@@ -321,14 +321,16 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
||||
stackTrace,
|
||||
);
|
||||
}
|
||||
if ((response['isError'] as bool?) ?? false)
|
||||
if ((response['isError'] as bool?) ?? false) {
|
||||
throw DriverError('Error in Flutter application: ${response['response']}');
|
||||
}
|
||||
return response['response'] as Map<String, dynamic>;
|
||||
}
|
||||
|
||||
void _logCommunication(String message) {
|
||||
if (_printCommunication)
|
||||
if (_printCommunication) {
|
||||
_log(message);
|
||||
}
|
||||
if (_logCommunicationToFile) {
|
||||
assert(_logFilePathName != null);
|
||||
final f.File file = fs.file(_logFilePathName);
|
||||
@@ -533,8 +535,9 @@ String _getWebSocketUrl(String url) {
|
||||
if (uri.pathSegments.isNotEmpty) uri.pathSegments.first,
|
||||
'ws',
|
||||
];
|
||||
if (uri.scheme == 'http')
|
||||
if (uri.scheme == 'http') {
|
||||
uri = uri.replace(scheme: 'ws', pathSegments: pathSegments);
|
||||
}
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user