Skip to content

Commit 34d5039

Browse files
authored
[camera_platform_interface] Add API support query for image streaming (flutter#8307)
Add API support query, supportsImageStreaming for checking if the camera platform supports image streaming. As requested on this comment: flutter#8234 (comment) Step 3 from the [changing federated plugins guide](https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins), split off from flutter#8250 with a new Dart test added.
1 parent 0e189f7 commit 34d5039

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

packages/camera/camera_platform_interface/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 2.9.0
22

33
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
4+
* Adds API support query for image streaming.
45

56
## 2.8.0
67

packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ abstract class CameraPlatform extends PlatformInterface {
173173
throw UnimplementedError('resumeVideoRecording() is not implemented.');
174174
}
175175

176+
/// Check whether this platform supports image streaming via [onStreamedFrameAvailable].
177+
bool supportsImageStreaming() => false;
178+
176179
/// A new streamed frame is available.
177180
///
178181
/// Listening to this stream will start streaming, and canceling will stop.

packages/camera/camera_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/camera/camera
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 2.8.0
7+
version: 2.9.0
88

99
environment:
1010
sdk: ^3.4.0

packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,19 @@ void main() {
496496
throwsUnimplementedError,
497497
);
498498
});
499+
500+
test(
501+
'Default implementation of supportsImageStreaming() should return false',
502+
() {
503+
// Arrange
504+
final ExtendsCameraPlatform cameraPlatform = ExtendsCameraPlatform();
505+
506+
// Act & Assert
507+
expect(
508+
cameraPlatform.supportsImageStreaming(),
509+
false,
510+
);
511+
});
499512
});
500513

501514
group('exports', () {

0 commit comments

Comments
 (0)