Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ linter:
# - no_default_cases # LOCAL CHANGE - Needs to be enabled and violations fixed.
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
# - no_leading_underscores_for_local_identifiers # LOCAL CHANGE - Needs to be enabled and violations fixed.
- no_leading_underscores_for_local_identifiers
- no_logic_in_create_state
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
- non_constant_identifier_names
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.0+3

* Updates code for `no_leading_underscores_for_local_identifiers` lint.

## 0.10.0+2

* Updates imports for `prefer_relative_imports`.
Expand Down
40 changes: 20 additions & 20 deletions packages/camera/camera/example/integration_test/camera_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,16 @@ void main() {
);

await controller.initialize();
bool _isDetecting = false;
bool isDetecting = false;

await controller.startImageStream((CameraImage image) {
if (_isDetecting) {
if (isDetecting) {
return;
}

_isDetecting = true;
isDetecting = true;

expectLater(image, isNotNull).whenComplete(() => _isDetecting = false);
expectLater(image, isNotNull).whenComplete(() => isDetecting = false);
});

expect(controller.value.isStreamingImages, true);
Expand All @@ -254,19 +254,19 @@ void main() {
);

await controller.initialize();
final Completer<CameraImage> _completer = Completer<CameraImage>();
final Completer<CameraImage> completer = Completer<CameraImage>();

await controller.startImageStream((CameraImage image) {
if (!_completer.isCompleted) {
if (!completer.isCompleted) {
Future<void>(() async {
await controller.stopImageStream();
await controller.dispose();
}).then((Object? value) {
_completer.complete(image);
completer.complete(image);
});
}
});
return _completer.future;
return completer.future;
}

testWidgets(
Expand All @@ -277,20 +277,20 @@ void main() {
return;
}

CameraImage _image = await startStreaming(cameras, null);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.bgra8888);
expect(_image.planes.length, 1);
CameraImage image = await startStreaming(cameras, null);
expect(image, isNotNull);
expect(image.format.group, ImageFormatGroup.bgra8888);
expect(image.planes.length, 1);

_image = await startStreaming(cameras, ImageFormatGroup.yuv420);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.yuv420);
expect(_image.planes.length, 2);
image = await startStreaming(cameras, ImageFormatGroup.yuv420);
expect(image, isNotNull);
expect(image.format.group, ImageFormatGroup.yuv420);
expect(image.planes.length, 2);

_image = await startStreaming(cameras, ImageFormatGroup.bgra8888);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.bgra8888);
expect(_image.planes.length, 1);
image = await startStreaming(cameras, ImageFormatGroup.bgra8888);
expect(image, isNotNull);
expect(image.format.group, ImageFormatGroup.bgra8888);
expect(image.planes.length, 1);
},
skip: !Platform.isIOS,
);
Expand Down
14 changes: 7 additions & 7 deletions packages/camera/camera/lib/src/camera_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class CameraController extends ValueNotifier<CameraValue> {
);
}
try {
final Completer<CameraInitializedEvent> _initializeCompleter =
final Completer<CameraInitializedEvent> initializeCompleter =
Completer<CameraInitializedEvent>();

_deviceOrientationSubscription = CameraPlatform.instance
Expand All @@ -303,7 +303,7 @@ class CameraController extends ValueNotifier<CameraValue> {
.onCameraInitialized(_cameraId)
.first
.then((CameraInitializedEvent event) {
_initializeCompleter.complete(event);
initializeCompleter.complete(event);
}));

await CameraPlatform.instance.initializeCamera(
Expand All @@ -313,18 +313,18 @@ class CameraController extends ValueNotifier<CameraValue> {

value = value.copyWith(
isInitialized: true,
previewSize: await _initializeCompleter.future
previewSize: await initializeCompleter.future
.then((CameraInitializedEvent event) => Size(
event.previewWidth,
event.previewHeight,
)),
exposureMode: await _initializeCompleter.future
exposureMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.exposureMode),
focusMode: await _initializeCompleter.future
focusMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusMode),
exposurePointSupported: await _initializeCompleter.future.then(
exposurePointSupported: await initializeCompleter.future.then(
(CameraInitializedEvent event) => event.exposurePointSupported),
focusPointSupported: await _initializeCompleter.future
focusPointSupported: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusPointSupported),
);
} on PlatformException catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
Dart.
repository: https://github.com/flutter/plugins/tree/main/packages/camera/camera
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.10.0+2
version: 0.10.0+3

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.0+3

* Updates code for `no_leading_underscores_for_local_identifiers` lint.

## 0.10.0+2

* Removes call to `join` on the camera's background `HandlerThread`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,16 @@ void main() {
);

await controller.initialize();
bool _isDetecting = false;
bool isDetecting = false;

await controller.startImageStream((CameraImageData image) {
if (_isDetecting) {
if (isDetecting) {
return;
}

_isDetecting = true;
isDetecting = true;

expectLater(image, isNotNull).whenComplete(() => _isDetecting = false);
expectLater(image, isNotNull).whenComplete(() => isDetecting = false);
});

expect(controller.value.isStreamingImages, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class CameraController extends ValueNotifier<CameraValue> {

/// Initializes the camera on the device.
Future<void> initialize() async {
final Completer<CameraInitializedEvent> _initializeCompleter =
final Completer<CameraInitializedEvent> initializeCompleter =
Completer<CameraInitializedEvent>();

_deviceOrientationSubscription = CameraPlatform.instance
Expand All @@ -224,7 +224,7 @@ class CameraController extends ValueNotifier<CameraValue> {
.onCameraInitialized(_cameraId)
.first
.then((CameraInitializedEvent event) {
_initializeCompleter.complete(event);
initializeCompleter.complete(event);
});

await CameraPlatform.instance.initializeCamera(
Expand All @@ -234,18 +234,18 @@ class CameraController extends ValueNotifier<CameraValue> {

value = value.copyWith(
isInitialized: true,
previewSize: await _initializeCompleter.future
previewSize: await initializeCompleter.future
.then((CameraInitializedEvent event) => Size(
event.previewWidth,
event.previewHeight,
)),
exposureMode: await _initializeCompleter.future
exposureMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.exposureMode),
focusMode: await _initializeCompleter.future
focusMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusMode),
exposurePointSupported: await _initializeCompleter.future
exposurePointSupported: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.exposurePointSupported),
focusPointSupported: await _initializeCompleter.future
focusPointSupported: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusPointSupported),
);

Expand Down
8 changes: 4 additions & 4 deletions packages/camera/camera_android/lib/src/android_camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ class AndroidCamera extends CameraPlatform {
return channel;
});

final Completer<void> _completer = Completer<void>();
final Completer<void> completer = Completer<void>();

onCameraInitialized(cameraId).first.then((CameraInitializedEvent value) {
_completer.complete();
completer.complete();
});

_channel.invokeMapMethod<String, dynamic>(
Expand All @@ -147,14 +147,14 @@ class AndroidCamera extends CameraPlatform {
if (error is! PlatformException) {
throw error;
}
_completer.completeError(
completer.completeError(
CameraException(error.code, error.message),
stackTrace,
);
},
);

return _completer.future;
return completer.future;
}

@override
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_android
description: Android implementation of the camera plugin.
repository: https://github.com/flutter/plugins/tree/main/packages/camera/camera_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.10.0+2
version: 0.10.0+3

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/camera/camera_avfoundation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.9.8+6

* Updates code for `no_leading_underscores_for_local_identifiers` lint.
* Updates minimum Flutter version to 2.10.

## 0.9.8+5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,19 @@ void main() {
);

await controller.initialize();
final Completer<CameraImageData> _completer = Completer<CameraImageData>();
final Completer<CameraImageData> completer = Completer<CameraImageData>();

await controller.startImageStream((CameraImageData image) {
if (!_completer.isCompleted) {
if (!completer.isCompleted) {
Future<void>(() async {
await controller.stopImageStream();
await controller.dispose();
}).then((Object? value) {
_completer.complete(image);
completer.complete(image);
});
}
});
return _completer.future;
return completer.future;
}

testWidgets(
Expand All @@ -237,20 +237,20 @@ void main() {
return;
}

CameraImageData _image = await startStreaming(cameras, null);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.bgra8888);
expect(_image.planes.length, 1);
CameraImageData image = await startStreaming(cameras, null);
expect(image, isNotNull);
expect(image.format.group, ImageFormatGroup.bgra8888);
expect(image.planes.length, 1);

_image = await startStreaming(cameras, ImageFormatGroup.yuv420);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.yuv420);
expect(_image.planes.length, 2);
image = await startStreaming(cameras, ImageFormatGroup.yuv420);
expect(image, isNotNull);
expect(image.format.group, ImageFormatGroup.yuv420);
expect(image.planes.length, 2);

_image = await startStreaming(cameras, ImageFormatGroup.bgra8888);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.bgra8888);
expect(_image.planes.length, 1);
image = await startStreaming(cameras, ImageFormatGroup.bgra8888);
expect(image, isNotNull);
expect(image.format.group, ImageFormatGroup.bgra8888);
expect(image.planes.length, 1);
},
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class CameraController extends ValueNotifier<CameraValue> {

/// Initializes the camera on the device.
Future<void> initialize() async {
final Completer<CameraInitializedEvent> _initializeCompleter =
final Completer<CameraInitializedEvent> initializeCompleter =
Completer<CameraInitializedEvent>();

_deviceOrientationSubscription = CameraPlatform.instance
Expand All @@ -224,7 +224,7 @@ class CameraController extends ValueNotifier<CameraValue> {
.onCameraInitialized(_cameraId)
.first
.then((CameraInitializedEvent event) {
_initializeCompleter.complete(event);
initializeCompleter.complete(event);
});

await CameraPlatform.instance.initializeCamera(
Expand All @@ -234,18 +234,18 @@ class CameraController extends ValueNotifier<CameraValue> {

value = value.copyWith(
isInitialized: true,
previewSize: await _initializeCompleter.future
previewSize: await initializeCompleter.future
.then((CameraInitializedEvent event) => Size(
event.previewWidth,
event.previewHeight,
)),
exposureMode: await _initializeCompleter.future
exposureMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.exposureMode),
focusMode: await _initializeCompleter.future
focusMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusMode),
exposurePointSupported: await _initializeCompleter.future
exposurePointSupported: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.exposurePointSupported),
focusPointSupported: await _initializeCompleter.future
focusPointSupported: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusPointSupported),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ class AVFoundationCamera extends CameraPlatform {
return channel;
});

final Completer<void> _completer = Completer<void>();
final Completer<void> completer = Completer<void>();

onCameraInitialized(cameraId).first.then((CameraInitializedEvent value) {
_completer.complete();
completer.complete();
});

_channel.invokeMapMethod<String, dynamic>(
Expand All @@ -147,14 +147,14 @@ class AVFoundationCamera extends CameraPlatform {
if (error is! PlatformException) {
throw error;
}
_completer.completeError(
completer.completeError(
CameraException(error.code, error.message),
stackTrace,
);
},
);

return _completer.future;
return completer.future;
}

@override
Expand Down
Loading