diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index 2fc4d7ba2ee..4df15431a74 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.21+4 + +* Add lensType to CameraDescription + ## 0.9.21+3 * Removes code for versions of iOS older than 13.0. diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/AvailableCamerasTests.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/AvailableCamerasTests.swift index 043afad6fc1..85a60dff2ba 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/AvailableCamerasTests.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/AvailableCamerasTests.swift @@ -38,18 +38,22 @@ final class AvailableCamerasTest: XCTestCase { let wideAngleCamera = MockCaptureDevice() wideAngleCamera.uniqueID = "0" wideAngleCamera.position = .back + wideAngleCamera.deviceType = .builtInWideAngleCamera let frontFacingCamera = MockCaptureDevice() frontFacingCamera.uniqueID = "1" frontFacingCamera.position = .front + frontFacingCamera.deviceType = .builtInWideAngleCamera let ultraWideCamera = MockCaptureDevice() ultraWideCamera.uniqueID = "2" ultraWideCamera.position = .back + ultraWideCamera.deviceType = .builtInUltraWideCamera let telephotoCamera = MockCaptureDevice() telephotoCamera.uniqueID = "3" telephotoCamera.position = .back + telephotoCamera.deviceType = .builtInTelephotoCamera var requiredTypes: [AVCaptureDevice.DeviceType] = [ .builtInWideAngleCamera, .builtInTelephotoCamera, .builtInUltraWideCamera, @@ -84,10 +88,12 @@ final class AvailableCamerasTest: XCTestCase { let wideAngleCamera = MockCaptureDevice() wideAngleCamera.uniqueID = "0" wideAngleCamera.position = .back + wideAngleCamera.deviceType = .builtInWideAngleCamera let frontFacingCamera = MockCaptureDevice() frontFacingCamera.uniqueID = "1" frontFacingCamera.position = .front + frontFacingCamera.deviceType = .builtInWideAngleCamera var requiredTypes: [AVCaptureDevice.DeviceType] = [ .builtInWideAngleCamera, .builtInTelephotoCamera, .builtInUltraWideCamera, @@ -121,6 +127,7 @@ final class AvailableCamerasTest: XCTestCase { let unspecifiedCamera = MockCaptureDevice() unspecifiedCamera.uniqueID = "0" unspecifiedCamera.position = .unspecified + unspecifiedCamera.deviceType = var requiredTypes: [AVCaptureDevice.DeviceType] = [ .builtInWideAngleCamera, .builtInTelephotoCamera, .builtInUltraWideCamera, diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDevice.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDevice.swift index 32d5ed1b430..996f13e92f6 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDevice.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDevice.swift @@ -32,6 +32,7 @@ class MockCaptureDevice: NSObject, FLTCaptureDevice { var uniqueID = "" var position = AVCaptureDevice.Position.unspecified + var deviceType: AVCaptureDevice.DeviceType? = nil var activeFormat: FLTCaptureDeviceFormat { get { diff --git a/packages/camera/camera_avfoundation/example/lib/main.dart b/packages/camera/camera_avfoundation/example/lib/main.dart index b6f7457ad0a..61ecf28f8a3 100644 --- a/packages/camera/camera_avfoundation/example/lib/main.dart +++ b/packages/camera/camera_avfoundation/example/lib/main.dart @@ -585,6 +585,8 @@ class _CameraExampleHomeState extends State } onNewCameraSelected(description); + + showInSnackBar('Selected lens type: ${description.lensType.name}.'); } if (_cameras.isEmpty) { diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift index 06cca01e74c..35119102b6b 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift @@ -157,10 +157,24 @@ extension CameraPlugin: FCPCameraApi { @unknown default: lensFacing = .external } + print(device.deviceType) + var lensType: FCPPlatformCameraLensType + + switch device.deviceType { + case .builtInWideAngleCamera: + lensType = .wide + case .builtInUltraWideCamera: + lensType = .ultraWide + case .builtInTelephotoCamera: + lensType = .telephoto + default: + lensType = .unknown + } let cameraDescription = FCPPlatformCameraDescription.make( withName: device.uniqueID, - lensDirection: lensFacing + lensDirection: lensFacing, + lensType: lensType ) reply.append(cameraDescription) } diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureDevice.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureDevice.m index 0c6b31709e1..c3d7999caa0 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureDevice.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/FLTCaptureDevice.m @@ -30,6 +30,11 @@ - (AVCaptureDevicePosition)position { return self.device.position; } +// Lens type +- (AVCaptureDeviceType)deviceType { + return self.device.deviceType; +} + // Format/Configuration - (NSObject *)activeFormat { return [[FLTDefaultCaptureDeviceFormat alloc] initWithFormat:self.device.activeFormat]; diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureDevice.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureDevice.h index 80735b8e167..ed1181f945e 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureDevice.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCaptureDevice.h @@ -24,6 +24,9 @@ NS_ASSUME_NONNULL_BEGIN // Position/Orientation @property(nonatomic, readonly) AVCaptureDevicePosition position; +// Device type +@property(nonatomic, readonly) AVCaptureDeviceType deviceType; + // Format/Configuration @property(nonatomic, retain) NSObject *activeFormat; @property(nonatomic, readonly) NSArray *> *formats; diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/messages.g.h index 2f1d8646afa..0d81273e5ae 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/messages.g.h @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v22.7.4), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -28,6 +28,23 @@ typedef NS_ENUM(NSUInteger, FCPPlatformCameraLensDirection) { - (instancetype)initWithValue:(FCPPlatformCameraLensDirection)value; @end +typedef NS_ENUM(NSUInteger, FCPPlatformCameraLensType) { + /// A built-in wide-angle camera device type. + FCPPlatformCameraLensTypeWide = 0, + /// A built-in camera device type with a longer focal length than a wide-angle camera. + FCPPlatformCameraLensTypeTelephoto = 1, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. + FCPPlatformCameraLensTypeUltraWide = 2, + /// Unknown camera device type. + FCPPlatformCameraLensTypeUnknown = 3, +}; + +/// Wrapper for FCPPlatformCameraLensType to allow for nullability. +@interface FCPPlatformCameraLensTypeBox : NSObject +@property(nonatomic, assign) FCPPlatformCameraLensType value; +- (instancetype)initWithValue:(FCPPlatformCameraLensType)value; +@end + typedef NS_ENUM(NSUInteger, FCPPlatformDeviceOrientation) { FCPPlatformDeviceOrientationPortraitUp = 0, FCPPlatformDeviceOrientationLandscapeLeft = 1, @@ -124,62 +141,67 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType; /// The name of the camera device. -@property(nonatomic, copy) NSString *name; +@property(nonatomic, copy) NSString * name; /// The direction the camera is facing. @property(nonatomic, assign) FCPPlatformCameraLensDirection lensDirection; +/// The type of the camera lense +@property(nonatomic, assign) FCPPlatformCameraLensType lensType; @end @interface FCPPlatformCameraState : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported; /// The size of the preview, in pixels. -@property(nonatomic, strong) FCPPlatformSize *previewSize; +@property(nonatomic, strong) FCPPlatformSize * previewSize; /// The default exposure mode @property(nonatomic, assign) FCPPlatformExposureMode exposureMode; /// The default focus mode @property(nonatomic, assign) FCPPlatformFocusMode focusMode; /// Whether setting exposure points is supported. -@property(nonatomic, assign) BOOL exposurePointSupported; +@property(nonatomic, assign) BOOL exposurePointSupported; /// Whether setting focus points is supported. -@property(nonatomic, assign) BOOL focusPointSupported; +@property(nonatomic, assign) BOOL focusPointSupported; @end @interface FCPPlatformMediaSettings : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio; @property(nonatomic, assign) FCPPlatformResolutionPreset resolutionPreset; -@property(nonatomic, strong, nullable) NSNumber *framesPerSecond; -@property(nonatomic, strong, nullable) NSNumber *videoBitrate; -@property(nonatomic, strong, nullable) NSNumber *audioBitrate; -@property(nonatomic, assign) BOOL enableAudio; +@property(nonatomic, strong, nullable) NSNumber * framesPerSecond; +@property(nonatomic, strong, nullable) NSNumber * videoBitrate; +@property(nonatomic, strong, nullable) NSNumber * audioBitrate; +@property(nonatomic, assign) BOOL enableAudio; @end @interface FCPPlatformPoint : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithX:(double)x y:(double)y; -@property(nonatomic, assign) double x; -@property(nonatomic, assign) double y; ++ (instancetype)makeWithX:(double )x + y:(double )y; +@property(nonatomic, assign) double x; +@property(nonatomic, assign) double y; @end @interface FCPPlatformSize : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithWidth:(double)width height:(double)height; -@property(nonatomic, assign) double width; -@property(nonatomic, assign) double height; ++ (instancetype)makeWithWidth:(double )width + height:(double )height; +@property(nonatomic, assign) double width; +@property(nonatomic, assign) double height; @end /// The codec used by all APIs. @@ -187,16 +209,11 @@ NSObject *FCPGetMessagesCodec(void); @protocol FCPCameraApi /// Returns the list of available cameras. -- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; +- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; /// Create a new camera with the given settings, and returns its ID. -- (void)createCameraWithName:(NSString *)cameraName - settings:(FCPPlatformMediaSettings *)settings - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createCameraWithName:(NSString *)cameraName settings:(FCPPlatformMediaSettings *)settings completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Initializes the camera with the given ID. -- (void)initializeCamera:(NSInteger)cameraId - withImageFormat:(FCPPlatformImageFormatGroup)imageFormat - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializeCamera:(NSInteger)cameraId withImageFormat:(FCPPlatformImageFormatGroup)imageFormat completion:(void (^)(FlutterError *_Nullable))completion; /// Begins streaming frames from the camera. - (void)startImageStreamWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Stops streaming frames from the camera. @@ -210,39 +227,32 @@ NSObject *FCPGetMessagesCodec(void); /// and any associated resources can be cleaned up. - (void)disposeCamera:(NSInteger)cameraId completion:(void (^)(FlutterError *_Nullable))completion; /// Locks the camera capture to the current device orientation. -- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. - (void)unlockCaptureOrientationWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Takes a picture with the current settings, and returns the path to the /// resulting file. -- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Does any preprocessing necessary before beginning to record video. - (void)prepareForVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Begins recording video, optionally enabling streaming to Dart at the same /// time. -- (void)startVideoRecordingWithStreaming:(BOOL)enableStream - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)startVideoRecordingWithStreaming:(BOOL)enableStream completion:(void (^)(FlutterError *_Nullable))completion; /// Stops recording video, and results the path to the resulting file. -- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Pauses video recording. - (void)pauseVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Resumes a previously paused video recording. - (void)resumeVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given flash mode. -- (void)setFlashMode:(FCPPlatformFlashMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFlashMode:(FCPPlatformFlashMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given exposure mode. -- (void)setExposureMode:(FCPPlatformExposureMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposureMode:(FCPPlatformExposureMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-exposure to the given point in (0,1) coordinate space. /// /// A null value resets to the default exposure point. -- (void)setExposurePoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposurePoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum exposure offset supported by the camera. - (void)getMinimumExposureOffset:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum exposure offset supported by the camera. @@ -250,13 +260,11 @@ NSObject *FCPGetMessagesCodec(void); /// Sets the exposure offset manually to the given value. - (void)setExposureOffset:(double)offset completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given focus mode. -- (void)setFocusMode:(FCPPlatformFocusMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusMode:(FCPPlatformFocusMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-focus to the given point in (0,1) coordinate space. /// /// A null value resets to the default focus point. -- (void)setFocusPoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusPoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum zoom level supported by the camera. - (void)getMinimumZoomLevel:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum zoom level supported by the camera. @@ -270,40 +278,33 @@ NSObject *FCPGetMessagesCodec(void); /// Changes the camera used while recording video. /// /// This should only be called while video recording is active. -- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName completion:(void (^)(FlutterError *_Nullable))completion; /// Sets the file format used for taking pictures. -- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFCPCameraApi(id binaryMessenger, - NSObject *_Nullable api); +extern void SetUpFCPCameraApi(id binaryMessenger, NSObject *_Nullable api); + +extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); -extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the device's physical orientation changes. -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; @end + /// Handler for native callbacks that are tied to a specific camera ID. /// /// This is intended to be initialized with the camera ID as a suffix. @interface FCPCameraEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the camera is inialitized for use. -- (void)initializedWithState:(FCPPlatformCameraState *)initialState - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializedWithState:(FCPPlatformCameraState *)initialState completion:(void (^)(FlutterError *_Nullable))completion; /// Called when an error occurs in the camera. /// /// This should be used for errors that occur outside of the context of diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/messages.g.m index 0164b4d6c6c..1494bbe9e64 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/messages.g.m @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v22.7.4), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "./include/camera_avfoundation/messages.g.h" @@ -26,12 +26,7 @@ } static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError - errorWithCode:@"channel-error" - message:[NSString stringWithFormat:@"%@/%@/%@", - @"Unable to establish connection on channel: '", - channelName, @"'."] - details:@""]; + return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @@ -49,6 +44,16 @@ - (instancetype)initWithValue:(FCPPlatformCameraLensDirection)value { } @end +@implementation FCPPlatformCameraLensTypeBox +- (instancetype)initWithValue:(FCPPlatformCameraLensType)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + @implementation FCPPlatformDeviceOrientationBox - (instancetype)initWithValue:(FCPPlatformDeviceOrientation)value { self = [super init]; @@ -152,18 +157,21 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection { - FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType { + FCPPlatformCameraDescription* pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = name; pigeonResult.lensDirection = lensDirection; + pigeonResult.lensType = lensType; return pigeonResult; } + (FCPPlatformCameraDescription *)fromList:(NSArray *)list { FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = - GetNullableObjectAtIndex(list, 1); + FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = GetNullableObjectAtIndex(list, 1); pigeonResult.lensDirection = boxedFCPPlatformCameraLensDirection.value; + FCPPlatformCameraLensTypeBox *boxedFCPPlatformCameraLensType = GetNullableObjectAtIndex(list, 2); + pigeonResult.lensType = boxedFCPPlatformCameraLensType.value; return pigeonResult; } + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list { @@ -173,17 +181,18 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list return @[ self.name ?: [NSNull null], [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:self.lensDirection], + [[FCPPlatformCameraLensTypeBox alloc] initWithValue:self.lensType], ]; } @end @implementation FCPPlatformCameraState + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported { - FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported { + FCPPlatformCameraState* pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = previewSize; pigeonResult.exposureMode = exposureMode; pigeonResult.focusMode = focusMode; @@ -218,11 +227,11 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { @implementation FCPPlatformMediaSettings + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio { - FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio { + FCPPlatformMediaSettings* pigeonResult = [[FCPPlatformMediaSettings alloc] init]; pigeonResult.resolutionPreset = resolutionPreset; pigeonResult.framesPerSecond = framesPerSecond; pigeonResult.videoBitrate = videoBitrate; @@ -232,8 +241,7 @@ + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolution } + (FCPPlatformMediaSettings *)fromList:(NSArray *)list { FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; - FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = - GetNullableObjectAtIndex(list, 0); + FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = GetNullableObjectAtIndex(list, 0); pigeonResult.resolutionPreset = boxedFCPPlatformResolutionPreset.value; pigeonResult.framesPerSecond = GetNullableObjectAtIndex(list, 1); pigeonResult.videoBitrate = GetNullableObjectAtIndex(list, 2); @@ -256,8 +264,9 @@ + (nullable FCPPlatformMediaSettings *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformPoint -+ (instancetype)makeWithX:(double)x y:(double)y { - FCPPlatformPoint *pigeonResult = [[FCPPlatformPoint alloc] init]; ++ (instancetype)makeWithX:(double )x + y:(double )y { + FCPPlatformPoint* pigeonResult = [[FCPPlatformPoint alloc] init]; pigeonResult.x = x; pigeonResult.y = y; return pigeonResult; @@ -280,8 +289,9 @@ + (nullable FCPPlatformPoint *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformSize -+ (instancetype)makeWithWidth:(double)width height:(double)height { - FCPPlatformSize *pigeonResult = [[FCPPlatformSize alloc] init]; ++ (instancetype)makeWithWidth:(double )width + height:(double )height { + FCPPlatformSize* pigeonResult = [[FCPPlatformSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -310,61 +320,49 @@ - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 129: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformCameraLensDirectionBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 130: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformDeviceOrientationBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 131: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformDeviceOrientationBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 132: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 133: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 134: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFileFormatBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 135: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFormatGroupBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFileFormatBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 136: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformResolutionPresetBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFormatGroupBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 137: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformResolutionPresetBox alloc] initWithValue:[enumAsNumber integerValue]]; } - case 137: + case 138: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 138: + case 139: return [FCPPlatformCameraState fromList:[self readValue]]; - case 139: + case 140: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 140: + case 141: return [FCPPlatformPoint fromList:[self readValue]]; - case 141: + case 142: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -380,48 +378,52 @@ - (void)writeValue:(id)value { FCPPlatformCameraLensDirectionBox *box = (FCPPlatformCameraLensDirectionBox *)value; [self writeByte:129]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[FCPPlatformCameraLensTypeBox class]]) { + FCPPlatformCameraLensTypeBox *box = (FCPPlatformCameraLensTypeBox *)value; + [self writeByte:130]; + [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformDeviceOrientationBox class]]) { FCPPlatformDeviceOrientationBox *box = (FCPPlatformDeviceOrientationBox *)value; - [self writeByte:130]; + [self writeByte:131]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformExposureModeBox class]]) { FCPPlatformExposureModeBox *box = (FCPPlatformExposureModeBox *)value; - [self writeByte:131]; + [self writeByte:132]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformFlashModeBox class]]) { FCPPlatformFlashModeBox *box = (FCPPlatformFlashModeBox *)value; - [self writeByte:132]; + [self writeByte:133]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformFocusModeBox class]]) { FCPPlatformFocusModeBox *box = (FCPPlatformFocusModeBox *)value; - [self writeByte:133]; + [self writeByte:134]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformImageFileFormatBox class]]) { FCPPlatformImageFileFormatBox *box = (FCPPlatformImageFileFormatBox *)value; - [self writeByte:134]; + [self writeByte:135]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformImageFormatGroupBox class]]) { FCPPlatformImageFormatGroupBox *box = (FCPPlatformImageFormatGroupBox *)value; - [self writeByte:135]; + [self writeByte:136]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformResolutionPresetBox class]]) { FCPPlatformResolutionPresetBox *box = (FCPPlatformResolutionPresetBox *)value; - [self writeByte:136]; + [self writeByte:137]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformCameraDescription class]]) { - [self writeByte:137]; + [self writeByte:138]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformCameraState class]]) { - [self writeByte:138]; + [self writeByte:139]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformMediaSettings class]]) { - [self writeByte:139]; + [self writeByte:140]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformPoint class]]) { - [self writeByte:140]; + [self writeByte:141]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformSize class]]) { - [self writeByte:141]; + [self writeByte:142]; [self writeValue:[value toList]]; } else { [super writeValue:value]; @@ -444,8 +446,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FCPMessagesPigeonCodecReaderWriter *readerWriter = - [[FCPMessagesPigeonCodecReaderWriter alloc] init]; + FCPMessagesPigeonCodecReaderWriter *readerWriter = [[FCPMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; @@ -454,29 +455,19 @@ void SetUpFCPCameraApi(id binaryMessenger, NSObject binaryMessenger, - NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; +void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; /// Returns the list of available cameras. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getAvailableCameras", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(availableCamerasWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api availableCamerasWithCompletion:^( - NSArray *_Nullable output, - FlutterError *_Nullable error) { + [api availableCamerasWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -486,27 +477,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Create a new camera with the given settings, and returns its ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(createCameraWithName:settings:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); FCPPlatformMediaSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api createCameraWithName:arg_cameraName - settings:arg_settings - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api createCameraWithName:arg_cameraName settings:arg_settings completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -514,30 +498,21 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Initializes the camera with the given ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(initializeCamera:withImageFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = - GetNullableObjectAtIndex(args, 1); + FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = GetNullableObjectAtIndex(args, 1); FCPPlatformImageFormatGroup arg_imageFormat = boxedFCPPlatformImageFormatGroup.value; - [api initializeCamera:arg_cameraId - withImageFormat:arg_imageFormat - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -545,18 +520,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Begins streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(startImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api startImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -568,19 +538,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api stopImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -595,18 +559,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This is used to throttle sending frames across the channel. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.receivedImageStreamData", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(receivedImageStreamDataWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api receivedImageStreamDataWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -619,24 +578,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api disposeCamera:arg_cameraId - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api disposeCamera:arg_cameraId completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -644,27 +598,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Locks the camera capture to the current device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.lockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(lockCaptureOrientation:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = - GetNullableObjectAtIndex(args, 0); + FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = GetNullableObjectAtIndex(args, 0); FCPPlatformDeviceOrientation arg_orientation = boxedFCPPlatformDeviceOrientation.value; - [api lockCaptureOrientation:arg_orientation - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -673,18 +620,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.unlockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(unlockCaptureOrientationWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api unlockCaptureOrientationWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -697,23 +639,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Takes a picture with the current settings, and returns the path to the /// resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api - takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -721,18 +657,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Does any preprocessing necessary before beginning to record video. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.prepareForVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(prepareForVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api prepareForVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -745,25 +676,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Begins recording video, optionally enabling streaming to Dart at the same /// time. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(startVideoRecordingWithStreaming:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; BOOL arg_enableStream = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api startVideoRecordingWithStreaming:arg_enableStream - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api startVideoRecordingWithStreaming:arg_enableStream completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -771,21 +696,15 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops recording video, and results the path to the resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.stopVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { + [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -795,18 +714,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.pauseVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pauseVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -818,18 +732,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.resumeVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(resumeVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumeVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -841,26 +750,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given flash mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFlashModeBox *boxedFCPPlatformFlashMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFlashMode arg_mode = boxedFCPPlatformFlashMode.value; - [api setFlashMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -868,27 +771,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given exposure mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = - GetNullableObjectAtIndex(args, 0); + FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = GetNullableObjectAtIndex(args, 0); FCPPlatformExposureMode arg_mode = boxedFCPPlatformExposureMode.value; - [api setExposureMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -898,24 +794,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default exposure point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposurePoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setExposurePoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposurePoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -923,17 +814,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMinExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -945,17 +832,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMaxExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -967,25 +850,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the exposure offset manually to the given value. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setExposureOffset:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_offset = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setExposureOffset:arg_offset - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureOffset:arg_offset completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -993,26 +870,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given focus mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFocusMode arg_mode = boxedFCPPlatformFocusMode.value; - [api setFocusMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1022,25 +893,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default focus point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setFocusPoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusPoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1048,17 +913,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1070,17 +931,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1092,25 +949,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the zoom factor. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_zoom = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setZoomLevel:arg_zoom - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setZoomLevel:arg_zoom completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1118,18 +969,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses streaming of preview frames. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pausePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1141,18 +987,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused preview stream. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1166,26 +1007,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This should only be called while video recording is active. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.updateDescriptionWhileRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName: - completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(updateDescriptionWhileRecordingCameraName:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); - [api updateDescriptionWhileRecordingCameraName:arg_cameraName - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api updateDescriptionWhileRecordingCameraName:arg_cameraName completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1193,27 +1027,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the file format used for taking pictures. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setImageFileFormat", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setImageFileFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = - GetNullableObjectAtIndex(args, 0); + FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = GetNullableObjectAtIndex(args, 0); FCPPlatformImageFileFormat arg_format = boxedFCPPlatformImageFileFormat.value; - [api setImageFileFormat:arg_format - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1230,42 +1057,32 @@ @implementation FCPCameraGlobalEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", - _messageChannelSuffix]; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ [[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[[[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end @@ -1279,64 +1096,51 @@ @implementation FCPCameraEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", - _messageChannelSuffix]; +- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ arg_initialState ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } -- (void)reportError:(NSString *)arg_message - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", - _messageChannelSuffix]; +- (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ arg_message ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end + diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 41559ad05db..b630302d1b0 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v22.7.4), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -18,11 +18,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({ - Object? result, - PlatformException? error, - bool empty = false, -}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -35,14 +31,23 @@ List wrapResponse({ enum PlatformCameraLensDirection { /// Front facing camera (a user looking at the screen is seen by the camera). front, - /// Back facing camera (a user looking at the screen is not seen by the camera). back, - /// External camera which may not be mounted to the device. external, } +enum PlatformCameraLensType { + /// A built-in wide-angle camera device type. + wide, + /// A built-in camera device type with a longer focal length than a wide-angle camera. + telephoto, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. + ultraWide, + /// Unknown camera device type. + unknown, +} + enum PlatformDeviceOrientation { portraitUp, landscapeLeft, @@ -50,21 +55,49 @@ enum PlatformDeviceOrientation { landscapeRight, } -enum PlatformExposureMode { auto, locked } +enum PlatformExposureMode { + auto, + locked, +} -enum PlatformFlashMode { off, auto, always, torch } +enum PlatformFlashMode { + off, + auto, + always, + torch, +} -enum PlatformFocusMode { auto, locked } +enum PlatformFocusMode { + auto, + locked, +} /// Pigeon version of ImageFileFormat. -enum PlatformImageFileFormat { jpeg, heif } +enum PlatformImageFileFormat { + jpeg, + heif, +} -enum PlatformImageFormatGroup { bgra8888, yuv420 } +enum PlatformImageFormatGroup { + bgra8888, + yuv420, +} -enum PlatformResolutionPreset { low, medium, high, veryHigh, ultraHigh, max } +enum PlatformResolutionPreset { + low, + medium, + high, + veryHigh, + ultraHigh, + max, +} class PlatformCameraDescription { - PlatformCameraDescription({required this.name, required this.lensDirection}); + PlatformCameraDescription({ + required this.name, + required this.lensDirection, + required this.lensType, + }); /// The name of the camera device. String name; @@ -72,8 +105,15 @@ class PlatformCameraDescription { /// The direction the camera is facing. PlatformCameraLensDirection lensDirection; + /// The type of the camera lense + PlatformCameraLensType lensType; + Object encode() { - return [name, lensDirection]; + return [ + name, + lensDirection, + lensType, + ]; } static PlatformCameraDescription decode(Object result) { @@ -81,6 +121,7 @@ class PlatformCameraDescription { return PlatformCameraDescription( name: result[0]! as String, lensDirection: result[1]! as PlatformCameraLensDirection, + lensType: result[2]! as PlatformCameraLensType, ); } } @@ -173,31 +214,46 @@ class PlatformMediaSettings { } class PlatformPoint { - PlatformPoint({required this.x, required this.y}); + PlatformPoint({ + required this.x, + required this.y, + }); double x; double y; Object encode() { - return [x, y]; + return [ + x, + y, + ]; } static PlatformPoint decode(Object result) { result as List; - return PlatformPoint(x: result[0]! as double, y: result[1]! as double); + return PlatformPoint( + x: result[0]! as double, + y: result[1]! as double, + ); } } class PlatformSize { - PlatformSize({required this.width, required this.height}); + PlatformSize({ + required this.width, + required this.height, + }); double width; double height; Object encode() { - return [width, height]; + return [ + width, + height, + ]; } static PlatformSize decode(Object result) { @@ -209,6 +265,7 @@ class PlatformSize { } } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -216,45 +273,48 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformCameraLensDirection) { + } else if (value is PlatformCameraLensDirection) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformDeviceOrientation) { + } else if (value is PlatformCameraLensType) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformExposureMode) { + } else if (value is PlatformDeviceOrientation) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformFlashMode) { + } else if (value is PlatformExposureMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformFocusMode) { + } else if (value is PlatformFlashMode) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is PlatformImageFileFormat) { + } else if (value is PlatformFocusMode) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is PlatformImageFormatGroup) { + } else if (value is PlatformImageFileFormat) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is PlatformResolutionPreset) { + } else if (value is PlatformImageFormatGroup) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is PlatformCameraDescription) { + } else if (value is PlatformResolutionPreset) { buffer.putUint8(137); - writeValue(buffer, value.encode()); - } else if (value is PlatformCameraState) { + writeValue(buffer, value.index); + } else if (value is PlatformCameraDescription) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformMediaSettings) { + } else if (value is PlatformCameraState) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformMediaSettings) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { + } else if (value is PlatformPoint) { buffer.putUint8(141); writeValue(buffer, value.encode()); + } else if (value is PlatformSize) { + buffer.putUint8(142); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -263,39 +323,42 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensDirection.values[value]; - case 130: + case 130: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformCameraLensType.values[value]; + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformDeviceOrientation.values[value]; - case 131: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformExposureMode.values[value]; - case 132: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFlashMode.values[value]; - case 133: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFocusMode.values[value]; - case 134: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFileFormat.values[value]; - case 135: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFormatGroup.values[value]; - case 136: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformResolutionPreset.values[value]; - case 137: + case 138: return PlatformCameraDescription.decode(readValue(buffer)!); - case 138: + case 139: return PlatformCameraState.decode(readValue(buffer)!); - case 139: + case 140: return PlatformMediaSettings.decode(readValue(buffer)!); - case 140: + case 141: return PlatformPoint.decode(readValue(buffer)!); - case 141: + case 142: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -307,13 +370,9 @@ class CameraApi { /// Constructor for [CameraApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CameraApi({ - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty - ? '.$messageChannelSuffix' - : ''; + CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -322,14 +381,12 @@ class CameraApi { /// Returns the list of available cameras. Future> getAvailableCameras() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -346,24 +403,20 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (pigeonVar_replyList[0] as List?)! - .cast(); + return (pigeonVar_replyList[0] as List?)!.cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = - await pigeonVar_channel.send([cameraName, settings]) - as List?; + await pigeonVar_channel.send([cameraName, settings]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -383,21 +436,15 @@ class CameraApi { } /// Initializes the camera with the given ID. - Future initialize( - int cameraId, - PlatformImageFormatGroup imageFormat, - ) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = - await pigeonVar_channel.send([cameraId, imageFormat]) - as List?; + await pigeonVar_channel.send([cameraId, imageFormat]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -413,14 +460,12 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -438,14 +483,12 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -466,14 +509,12 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -492,14 +533,12 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([cameraId]) as List?; if (pigeonVar_replyList == null) { @@ -516,17 +555,13 @@ class CameraApi { } /// Locks the camera capture to the current device orientation. - Future lockCaptureOrientation( - PlatformDeviceOrientation orientation, - ) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([orientation]) as List?; if (pigeonVar_replyList == null) { @@ -545,14 +580,12 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -571,14 +604,12 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -601,14 +632,12 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -627,14 +656,12 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([enableStream]) as List?; if (pigeonVar_replyList == null) { @@ -652,14 +679,12 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -682,14 +707,12 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -707,14 +730,12 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -732,14 +753,12 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([mode]) as List?; if (pigeonVar_replyList == null) { @@ -757,14 +776,12 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([mode]) as List?; if (pigeonVar_replyList == null) { @@ -784,14 +801,12 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([point]) as List?; if (pigeonVar_replyList == null) { @@ -809,14 +824,12 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -839,14 +852,12 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -869,14 +880,12 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([offset]) as List?; if (pigeonVar_replyList == null) { @@ -894,14 +903,12 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([mode]) as List?; if (pigeonVar_replyList == null) { @@ -921,14 +928,12 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([point]) as List?; if (pigeonVar_replyList == null) { @@ -946,14 +951,12 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -976,14 +979,12 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -1006,14 +1007,12 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([zoom]) as List?; if (pigeonVar_replyList == null) { @@ -1031,14 +1030,12 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -1056,14 +1053,12 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send(null) as List?; if (pigeonVar_replyList == null) { @@ -1083,14 +1078,12 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([cameraName]) as List?; if (pigeonVar_replyList == null) { @@ -1108,14 +1101,12 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final List? pigeonVar_replyList = await pigeonVar_channel.send([format]) as List?; if (pigeonVar_replyList == null) { @@ -1139,45 +1130,29 @@ abstract class CameraGlobalEventApi { /// Called when the device's physical orientation changes. void deviceOrientationChanged(PlatformDeviceOrientation orientation); - static void setUp( - CameraGlobalEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty - ? '.$messageChannelSuffix' - : ''; + static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger, - ); + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.', - ); + assert(message != null, + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = - (args[0] as PlatformDeviceOrientation?); - assert( - arg_orientation != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.', - ); + final PlatformDeviceOrientation? arg_orientation = (args[0] as PlatformDeviceOrientation?); + assert(arg_orientation != null, + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { api.deviceOrientationChanged(arg_orientation!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString()), - ); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -1200,79 +1175,54 @@ abstract class CameraEventApi { /// handling a specific HostApi call, such as during streaming. void error(String message); - static void setUp( - CameraEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty - ? '.$messageChannelSuffix' - : ''; + static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger, - ); + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.', - ); + assert(message != null, + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); final List args = (message as List?)!; - final PlatformCameraState? arg_initialState = - (args[0] as PlatformCameraState?); - assert( - arg_initialState != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.', - ); + final PlatformCameraState? arg_initialState = (args[0] as PlatformCameraState?); + assert(arg_initialState != null, + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.'); try { api.initialized(arg_initialState!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString()), - ); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger, - ); + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.', - ); + assert(message != null, + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); final List args = (message as List?)!; final String? arg_message = (args[0] as String?); - assert( - arg_message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null, expected non-null String.', - ); + assert(arg_message != null, + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null, expected non-null String.'); try { api.error(arg_message!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString()), - ); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } diff --git a/packages/camera/camera_avfoundation/lib/src/utils.dart b/packages/camera/camera_avfoundation/lib/src/utils.dart index e84a6d25930..68ef31d5b2d 100644 --- a/packages/camera/camera_avfoundation/lib/src/utils.dart +++ b/packages/camera/camera_avfoundation/lib/src/utils.dart @@ -15,6 +15,7 @@ CameraDescription cameraDescriptionFromPlatform( name: camera.name, lensDirection: cameraLensDirectionFromPlatform(camera.lensDirection), sensorOrientation: 90, + lensType: cameraLensTypeFromPlatform(camera.lensType), ); } @@ -29,6 +30,18 @@ CameraLensDirection cameraLensDirectionFromPlatform( }; } +/// Converts a Pigeon [PlatformCameraLensType] to a [CameraLensType]. +CameraLensType cameraLensTypeFromPlatform( + PlatformCameraLensType lensType, + ) { + return switch (lensType) { + PlatformCameraLensType.wide => CameraLensType.wide, + PlatformCameraLensType.ultraWide => CameraLensType.ultraWide, + PlatformCameraLensType.telephoto => CameraLensType.telephoto, + PlatformCameraLensType.unknown => CameraLensType.unknown, + }; +} + /// Convents the given device orientation to Pigeon. PlatformDeviceOrientation serializeDeviceOrientation( DeviceOrientation orientation, diff --git a/packages/camera/camera_avfoundation/pigeons/messages.dart b/packages/camera/camera_avfoundation/pigeons/messages.dart index 4b4ccffe1a9..2da3a15dbb3 100644 --- a/packages/camera/camera_avfoundation/pigeons/messages.dart +++ b/packages/camera/camera_avfoundation/pigeons/messages.dart @@ -30,6 +30,21 @@ enum PlatformCameraLensDirection { external, } +// Pigeon version of CameraLensType. +enum PlatformCameraLensType { + /// A built-in wide-angle camera device type. + wide, + + /// A built-in camera device type with a longer focal length than a wide-angle camera. + telephoto, + + /// A built-in camera device type with a shorter focal length than a wide-angle camera. + ultraWide, + + /// Unknown camera device type. + unknown, +} + // Pigeon version of DeviceOrientation. enum PlatformDeviceOrientation { portraitUp, @@ -65,6 +80,9 @@ class PlatformCameraDescription { /// The direction the camera is facing. final PlatformCameraLensDirection lensDirection; + + /// The type of the camera lense + final PlatformCameraLensType lensType; } // Pigeon version of the data needed for a CameraInitializedEvent. diff --git a/packages/camera/camera_avfoundation/pubspec.yaml b/packages/camera/camera_avfoundation/pubspec.yaml index e4f44045e43..4603ead6659 100644 --- a/packages/camera/camera_avfoundation/pubspec.yaml +++ b/packages/camera/camera_avfoundation/pubspec.yaml @@ -2,7 +2,7 @@ name: camera_avfoundation description: iOS implementation of the camera plugin. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_avfoundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.9.21+3 +version: 0.9.21+4 environment: sdk: ^3.9.0 diff --git a/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart b/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart index 7de3ef39b99..c01cdbfd846 100644 --- a/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart +++ b/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart @@ -407,10 +407,12 @@ void main() { PlatformCameraDescription( name: 'Test 1', lensDirection: PlatformCameraLensDirection.front, + lensType: PlatformCameraLensType.wide, ), PlatformCameraDescription( name: 'Test 2', lensDirection: PlatformCameraLensDirection.back, + lensType: PlatformCameraLensType.wide, ), ]; when(mockApi.getAvailableCameras()).thenAnswer((_) async => returnData); @@ -424,6 +426,10 @@ void main() { cameras[i].lensDirection, cameraLensDirectionFromPlatform(returnData[i].lensDirection), ); + expect( + cameras[i].lensType, + cameraLensTypeFromPlatform(returnData[i].lensType), + ); // This value isn't provided by the platform, so is hard-coded to 90. expect(cameras[i].sensorOrientation, 90); } diff --git a/packages/camera/camera_avfoundation/test/utils_test.dart b/packages/camera/camera_avfoundation/test/utils_test.dart index 24d2a507dc5..01f3fda7e01 100644 --- a/packages/camera/camera_avfoundation/test/utils_test.dart +++ b/packages/camera/camera_avfoundation/test/utils_test.dart @@ -25,6 +25,25 @@ void main() { ); }); + test('Should convert CameraLensType values correctly', () { + expect( + cameraLensTypeFromPlatform(PlatformCameraLensType.wide), + CameraLensType.wide, + ); + expect( + cameraLensTypeFromPlatform(PlatformCameraLensType.ultraWide), + CameraLensType.ultraWide, + ); + expect( + cameraLensTypeFromPlatform(PlatformCameraLensType.telephoto), + CameraLensType.telephoto, + ); + expect( + cameraLensTypeFromPlatform(PlatformCameraLensType.unknown), + CameraLensType.unknown, + ); + }); + test('serializeDeviceOrientation() should serialize correctly', () { expect( serializeDeviceOrientation(DeviceOrientation.portraitUp),