@@ -44,24 +44,10 @@ class CameraPicker extends StatefulWidget {
44
44
this .cameraQuarterTurns = 0 ,
45
45
this .foregroundBuilder,
46
46
CameraPickerTextDelegate ? textDelegate,
47
- }) : assert (enableRecording != null ),
48
- assert (onlyEnableRecording != null ),
49
- assert (enableAudio != null ),
50
- assert (enablePinchToZoom != null ),
51
- assert (enablePullToZoomInRecord != null ),
52
- assert (enableSetExposure != null ),
53
- assert (enableExposureControlOnPoint != null ),
54
- assert (shouldDeletePreviewFile != null ),
55
- assert (resolutionPreset != null ),
56
- assert (cameraQuarterTurns != null ),
57
- assert (
47
+ }) : assert (
58
48
enableRecording == true || onlyEnableRecording != true ,
59
49
'Recording mode error.' ,
60
50
),
61
- assert (
62
- resolutionPreset != null ,
63
- 'Resolution preset must not be null.' ,
64
- ),
65
51
super (key: key) {
66
52
Constants .textDelegate = textDelegate ??
67
53
(enableRecording
@@ -153,9 +139,6 @@ class CameraPicker extends StatefulWidget {
153
139
if (enableRecording != true && onlyEnableRecording == true ) {
154
140
throw ArgumentError ('Recording mode error.' );
155
141
}
156
- if (resolutionPreset == null ) {
157
- throw ArgumentError ('Resolution preset must not be null.' );
158
- }
159
142
final AssetEntity ? result = await Navigator .of (
160
143
context,
161
144
rootNavigator: true ,
@@ -430,7 +413,6 @@ class CameraPickerState extends State<CameraPicker>
430
413
/// Adjust the proper scale type according to the [controller] .
431
414
/// 通过 [controller] 的预览大小,判断相机预览适用的缩放类型。
432
415
_PreviewScaleType get _effectiveScaleType {
433
- assert (controller != null );
434
416
final Size _size = controller.value.previewSize! ;
435
417
final Size _scaledSize = _size * (Screens .widthPixels / _size.height);
436
418
if (_scaledSize.width > Screens .heightPixels) {
@@ -594,7 +576,6 @@ class CameraPickerState extends State<CameraPicker>
594
576
/// Use the specific [mode] to update the exposure mode.
595
577
/// 设置曝光模式
596
578
void switchExposureMode () {
597
- assert (controller != null );
598
579
if (_exposureMode.value == ExposureMode .auto) {
599
580
_exposureMode.value = ExposureMode .locked;
600
581
} else {
@@ -613,7 +594,6 @@ class CameraPickerState extends State<CameraPicker>
613
594
/// Use the [details] point to set exposure and focus.
614
595
/// 通过点击点的 [details] 设置曝光和对焦。
615
596
Future <void > setExposureAndFocusPoint (TapUpDetails details) async {
616
- assert (controller != null );
617
597
_isExposureModeDisplays.value = false ;
618
598
// Ignore point update when the new point is less than 8% and higher than
619
599
// 92% of the screen's height.
@@ -653,7 +633,6 @@ class CameraPickerState extends State<CameraPicker>
653
633
/// Update the exposure offset using the exposure controller.
654
634
/// 使用曝光控制器更新曝光值
655
635
void updateExposureOffset (double value) {
656
- assert (controller != null );
657
636
if (value == _currentExposureOffset.value) {
658
637
return ;
659
638
}
@@ -1159,8 +1138,6 @@ class CameraPickerState extends State<CameraPicker>
1159
1138
}
1160
1139
1161
1140
Widget _cameraPreview (BuildContext context) {
1162
- assert (controller != null );
1163
-
1164
1141
Widget _preview = Listener (
1165
1142
onPointerDown: (_) => _pointers++ ,
1166
1143
onPointerUp: (_) => _pointers-- ,
@@ -1214,7 +1191,6 @@ class CameraPickerState extends State<CameraPicker>
1214
1191
bool Function ()? isInitialized,
1215
1192
Widget ? child,
1216
1193
}) {
1217
- assert (builder != null );
1218
1194
return ValueListenableBuilder <CameraController ?>(
1219
1195
valueListenable: _controllerNotifier,
1220
1196
builder: (_, CameraController ? controller, __) {
0 commit comments