Skip to content

Commit 2923465

Browse files
committed
🔥 Remove unused extension
1 parent 3471945 commit 2923465

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

lib/src/internals/extensions.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,3 @@ extension SafeSetStateExtension on State {
1717
}
1818
}
1919
}
20-
21-
extension NullableObjectExtension on Object? {
22-
StackTrace? get nullableStackTrace {
23-
if (this is Error?) {
24-
return (this as Error?)?.stackTrace;
25-
}
26-
return null;
27-
}
28-
}

lib/src/internals/methods.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'dart:developer';
77
import 'package:flutter/foundation.dart';
88

99
import '../constants/type_defs.dart';
10-
import 'extensions.dart';
1110

1211
/// Log only in debug mode.
1312
/// 只在调试模式打印
@@ -17,10 +16,14 @@ void realDebugPrint(dynamic message) {
1716
}
1817
}
1918

20-
void handleErrorWithHandler(Object error, CameraErrorHandler? handler) {
19+
void handleErrorWithHandler(
20+
Object e,
21+
CameraErrorHandler? handler, {
22+
StackTrace? s,
23+
}) {
2124
if (handler != null) {
22-
handler(error, error.nullableStackTrace);
25+
handler(e, s);
2326
return;
2427
}
25-
throw error;
28+
throw e;
2629
}

lib/src/widgets/camera_picker.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ class CameraPickerState extends State<CameraPicker>
444444
(() async =>
445445
_minAvailableZoom = await controller.getMinZoomLevel())(),
446446
]);
447-
} catch (e) {
448-
handleErrorWithHandler(e, config.onError);
447+
} catch (e, s) {
448+
handleErrorWithHandler(e, config.onError, s: s);
449449
} finally {
450450
safeSetState(() {
451451
_shouldLockInitialize = false;
@@ -1041,7 +1041,7 @@ class CameraPickerState extends State<CameraPicker>
10411041
),
10421042
_initializeWrapper(
10431043
isInitialized: () =>
1044-
controller.value.isRecordingVideo &&
1044+
_controller?.value.isRecordingVideo == true &&
10451045
isRecordingRestricted,
10461046
builder: (_, __) => CircularProgressBar(
10471047
duration: maximumRecordingDuration!,

0 commit comments

Comments
 (0)