Skip to content

Commit 20c866c

Browse files
committed
🔊 Log initializations duration
1 parent 8c1707f commit 20c866c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/src/widgets/camera_picker.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,23 @@ class CameraPickerState extends State<CameraPicker>
404404
);
405405

406406
try {
407+
final Stopwatch stopwatch = Stopwatch()..start();
407408
await newController.initialize();
409+
stopwatch.stop();
410+
realDebugPrint("${stopwatch.elapsed} for controller's initialization.");
408411
// Call recording preparation first.
409412
if (shouldPrepareForVideoRecording) {
413+
stopwatch
414+
..reset()
415+
..start();
410416
await newController.prepareForVideoRecording();
417+
stopwatch.stop();
418+
realDebugPrint("${stopwatch.elapsed} for recording's preparation.");
411419
}
412420
// Then call other asynchronous methods.
421+
stopwatch
422+
..reset()
423+
..start();
413424
await Future.wait(
414425
<Future<void>>[
415426
if (config.lockCaptureOrientation != null)
@@ -430,6 +441,8 @@ class CameraPickerState extends State<CameraPicker>
430441
],
431442
eagerError: true,
432443
);
444+
stopwatch.stop();
445+
realDebugPrint("${stopwatch.elapsed} for config's update.");
433446
_controller = newController;
434447
} catch (e, s) {
435448
handleErrorWithHandler(e, config.onError, s: s);

0 commit comments

Comments
 (0)