Skip to content

Commit e29f063

Browse files
committed
[various] Enable avoid_print (part 2)
1 parent 9bc6854 commit e29f063

File tree

18 files changed

+31
-40
lines changed

18 files changed

+31
-40
lines changed

analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# This file is a copy of analysis_options.yaml from flutter/packages repo.
1+
# This file is a copy of analysis_options.yaml from flutter/packages repo
2+
# as of 2022-12-15.
23

34
analyzer:
45
language:

packages/camera/example/integration_test/camera_test.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ void main() {
4848
Future<bool> testCaptureImageResolution(
4949
CameraController controller, ResolutionPreset preset) async {
5050
final Size expectedSize = presetExpectedSizes[preset]!;
51-
print(
52-
'Capturing photo at $preset (${expectedSize.width}x${expectedSize.height}) using camera ${controller.description.name}');
5351

5452
// Take Picture
5553
final XFile file = await controller.takePicture();
@@ -93,8 +91,6 @@ void main() {
9391
Future<bool> testCaptureVideoResolution(
9492
CameraController controller, ResolutionPreset preset) async {
9593
final Size expectedSize = presetExpectedSizes[preset]!;
96-
print(
97-
'Capturing video at $preset (${expectedSize.width}x${expectedSize.height}) using camera ${controller.description.name}');
9894

9995
// Take Video
10096
await controller.startVideoRecording();

packages/camera/example/lib/main.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ IconData getCameraLensIcon(CameraLensDirection direction) {
3737
}
3838

3939
void _logError(String code, String? message) {
40-
if (message != null) {
41-
print('Error: $code\nError Message: $message');
42-
} else {
43-
print('Error: $code');
44-
}
40+
// ignore: avoid_print
41+
print('Error: $code${message == null ? '' : '\nError Message: $message'}');
4542
}
4643

4744
class _CameraExampleHomeState extends State<CameraExampleHome>

packages/firebase_core/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// ignore_for_file: public_member_api_docs
5+
// ignore_for_file: public_member_api_docs, avoid_print
66

77
import 'dart:async';
88
import 'dart:developer';

packages/google_maps_flutter/example/lib/map_coordinates.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class _MapCoordinatesBodyState extends State<_MapCoordinatesBody> {
7272
// Add a block at the bottom of this list to allow validation that the visible region of the map
7373
// does not change when scrolled under the safe view on iOS.
7474
// https://github.com/flutter/flutter/issues/107913
75-
Container(
75+
const SizedBox(
7676
width: 300,
7777
height: 1000,
7878
),

packages/google_maps_flutter/lib/src/convert.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ LatLngBounds _convertToBounds(String value) {
171171
northeast: LatLng(bound['north'] as double, bound['east'] as double));
172172
}
173173
} catch (e) {
174-
print('Javascript Error: $e');
174+
debugPrint('Javascript Error: $e');
175175
}
176176
return util.nullLatLngBounds;
177177
}
@@ -184,7 +184,7 @@ LatLng _convertToLatLng(String value) {
184184
return LatLng((latlng['lat'] as num) + 0.0, (latlng['lng'] as num) + 0.0);
185185
}
186186
} catch (e) {
187-
print('Javascript Error: $e');
187+
debugPrint('Javascript Error: $e');
188188
}
189189
return util.nullLatLng;
190190
}
@@ -205,7 +205,7 @@ ScreenCoordinate _convertToPoint(String value) {
205205
return ScreenCoordinate(x: x, y: y);
206206
}
207207
} catch (e) {
208-
print('Javascript Error: $e');
208+
debugPrint('Javascript Error: $e');
209209
}
210210
return util.nullScreenCoordinate;
211211
}

packages/google_maps_flutter/lib/src/google_maps_controller.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class GoogleMapsController {
229229
_streamController.add(MapReadyEvent(_mapId));
230230
_isFirst = true;
231231
} catch (e) {
232-
print('Javascript Error: $e');
232+
debugPrint('Javascript Error: $e');
233233
}
234234
});
235235
}
@@ -250,7 +250,7 @@ class GoogleMapsController {
250250
_streamController.add(MapTapEvent(_mapId, position));
251251
}
252252
} catch (e) {
253-
print('Javascript Error: $e');
253+
debugPrint('Javascript Error: $e');
254254
}
255255
});
256256
}
@@ -272,7 +272,7 @@ class GoogleMapsController {
272272
_streamController.add(MapLongPressEvent(_mapId, position));
273273
}
274274
} catch (e) {
275-
print('Javascript Error: $e');
275+
debugPrint('Javascript Error: $e');
276276
}
277277
});
278278
}
@@ -295,7 +295,7 @@ class GoogleMapsController {
295295
}
296296
}
297297
} catch (e) {
298-
print('Javascript Error: $e');
298+
debugPrint('Javascript Error: $e');
299299
}
300300
});
301301
}
@@ -327,7 +327,7 @@ class GoogleMapsController {
327327
}
328328
}
329329
} catch (e) {
330-
print('Javascript Error: $e');
330+
debugPrint('Javascript Error: $e');
331331
}
332332
});
333333
}
@@ -351,7 +351,7 @@ class GoogleMapsController {
351351
}
352352
}
353353
} catch (e) {
354-
print('Javascript Error: $e');
354+
debugPrint('Javascript Error: $e');
355355
}
356356
});
357357
}
@@ -375,7 +375,7 @@ class GoogleMapsController {
375375
}
376376
}
377377
} catch (e) {
378-
print('Javascript Error: $e');
378+
debugPrint('Javascript Error: $e');
379379
}
380380
});
381381
}
@@ -398,7 +398,7 @@ class GoogleMapsController {
398398
}
399399
}
400400
} catch (e) {
401-
print('Javascript Error: $e');
401+
debugPrint('Javascript Error: $e');
402402
}
403403
});
404404
}
@@ -542,7 +542,7 @@ class GoogleMapsController {
542542
try {
543543
return double.parse(await _callMethod(c, 'getZoom', <String>[]));
544544
} catch (e) {
545-
print('Javascript Error: $e');
545+
debugPrint('Javascript Error: $e');
546546
return 0.0;
547547
}
548548
}
@@ -614,7 +614,7 @@ class GoogleMapsController {
614614
focusLatLng = await _pixelToLatLng(
615615
json[2][0] as double, json[2][1] as double);
616616
} catch (e) {
617-
print('Error computing focus LatLng. JS Error: $e');
617+
debugPrint('Error computing focus LatLng. JS Error: $e');
618618
}
619619
}
620620
await _setZoom('${(await getZoomLevel()) + newZoomDelta}');

packages/google_sign_in/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// ignore_for_file: public_member_api_docs
5+
// ignore_for_file: public_member_api_docs, avoid_print
66

77
import 'dart:async';
88
import 'dart:convert' show json;

packages/image_picker/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// ignore_for_file: public_member_api_docs
5+
// ignore_for_file: public_member_api_docs, avoid_print
66

77
import 'dart:async';
88
import 'dart:io';

packages/messageport/example/integration_test/messageport_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ void main() {
7676
final LocalPort localPort = await LocalPort.create(kTestPort);
7777
final Completer<List<dynamic>> completer = Completer<List<dynamic>>();
7878
localPort.register((dynamic message, [RemotePort? remotePort]) {
79-
if (completer.isCompleted) {
80-
print('WARNING: additional message received: $message');
81-
} else {
79+
if (!completer.isCompleted) {
8280
completer.complete(<dynamic>[message, remotePort]);
8381
}
8482
});

0 commit comments

Comments
 (0)