Skip to content

Commit aa7a474

Browse files
[camera] Restore compatibility with older Flutter (flutter#4885)
1 parent 4d5db35 commit aa7a474

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

packages/camera/camera/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.9.4+14
2+
3+
* Restores compatibility with Flutter 2.5 and 2.8.
4+
15
## 0.9.4+13
26

37
* Updates iOS camera's photo capture delegate reference on a background queue to prevent potential race conditions, and some related internal code cleanup.

packages/camera/camera/lib/src/camera_controller.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Future<List<CameraDescription>> availableCameras() async {
2929
return CameraPlatform.instance.availableCameras();
3030
}
3131

32+
// TODO(stuartmorgan): Remove this once the package requires 2.10, where the
33+
// dart:async `unawaited` accepts a nullable future.
34+
void _unawaited(Future<void>? future) {}
35+
3236
/// The state of a [CameraController].
3337
class CameraValue {
3438
/// Creates a new camera controller state.
@@ -296,7 +300,7 @@ class CameraController extends ValueNotifier<CameraValue> {
296300
enableAudio: enableAudio,
297301
);
298302

299-
unawaited(CameraPlatform.instance
303+
_unawaited(CameraPlatform.instance
300304
.onCameraInitialized(_cameraId)
301305
.first
302306
.then((CameraInitializedEvent event) {
@@ -810,7 +814,7 @@ class CameraController extends ValueNotifier<CameraValue> {
810814
if (_isDisposed) {
811815
return;
812816
}
813-
unawaited(_deviceOrientationSubscription?.cancel());
817+
_unawaited(_deviceOrientationSubscription?.cancel());
814818
_isDisposed = true;
815819
super.dispose();
816820
if (_initCalled != null) {

packages/camera/camera/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
44
Dart.
55
repository: https://github.com/flutter/plugins/tree/main/packages/camera/camera
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
7-
version: 0.9.4+13
7+
version: 0.9.4+14
88

99
environment:
1010
sdk: ">=2.14.0 <3.0.0"

0 commit comments

Comments
 (0)