@@ -480,13 +480,12 @@ class CameraController extends ValueNotifier<CameraValue> {
480480 /// Throws a [CameraException] if image streaming or video recording has
481481 /// already started.
482482 ///
483- /// The `startImageStream` method is only available on Android and iOS (other
484- /// platforms won't be supported in current setup) .
483+ /// The `startImageStream` method is only available on platforms that
484+ /// report support for image streaming via [supportsImageStreaming] .
485485 ///
486486 // TODO(bmparr): Add settings for resolution and fps.
487487 Future <void > startImageStream (onLatestImageAvailable onAvailable) async {
488- assert (defaultTargetPlatform == TargetPlatform .android ||
489- defaultTargetPlatform == TargetPlatform .iOS);
488+ assert (supportsImageStreaming ());
490489 _throwIfNotInitialized ('startImageStream' );
491490 if (value.isRecordingVideo) {
492491 throw CameraException (
@@ -518,11 +517,10 @@ class CameraController extends ValueNotifier<CameraValue> {
518517 /// Throws a [CameraException] if image streaming was not started or video
519518 /// recording was started.
520519 ///
521- /// The `stopImageStream` method is only available on Android and iOS (other
522- /// platforms won't be supported in current setup) .
520+ /// The `stopImageStream` method is only available on platforms that
521+ /// report support for image streaming via [supportsImageStreaming] .
523522 Future <void > stopImageStream () async {
524- assert (defaultTargetPlatform == TargetPlatform .android ||
525- defaultTargetPlatform == TargetPlatform .iOS);
523+ assert (supportsImageStreaming ());
526524 _throwIfNotInitialized ('stopImageStream' );
527525 if (! value.isStreamingImages) {
528526 throw CameraException (
@@ -871,6 +869,10 @@ class CameraController extends ValueNotifier<CameraValue> {
871869 }
872870 }
873871
872+ /// Check whether the camera platform supports image streaming.
873+ bool supportsImageStreaming () =>
874+ CameraPlatform .instance.supportsImageStreaming ();
875+
874876 /// Releases the resources of this camera.
875877 @override
876878 Future <void > dispose () async {
0 commit comments