Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
906 stars 199 forks source link

Cast error occurs when using CameraInterface.availableSizes() #435

Closed sakyoyuto closed 4 months ago

sakyoyuto commented 5 months ago

Steps to Reproduce

I used camerawesome 2.0.0+1 and

await CameraInterface().availableSizes();

on iPhone 15 Pro.

Expected results

The value of List<PreviewSize?> should be returned.

Actual results

Then the following error occurred.

flutter: type 'int' is not a subtype of type 'double' in type cast
flutter: 
#0      PreviewSize.decode (package:camerawesome/pigeon.dart:121:25)
#1      _CameraInterfaceCodec.readValueOfType (package:camerawesome/pigeon.dart:707:28)
#2      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:477:12)
#3      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:522:23)
#4      _CameraInterfaceCodec.readValueOfType (package:camerawesome/pigeon.dart:713:22)
#5      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:477:12)
#6      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:522:23)
#7      _CameraInterfaceCodec.readValueOfType (package:camerawesome/pigeon.dart:713:22)
#8      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:477:12)
#9      StandardMessageCodec.decodeMessage (package:flutter/src/services/message_codecs.dart:341:28)
#10     BasicMessageChannel.send (package:flutter/src/services/platform_channel.dart:206:18)
<asynchronous suspension>
#11     CameraInterface.availableSizes (package:camerawesome/pigeon.dart:1366:38)
<asynchronous suspension>
#12     CameraView.build.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:cheesecake/widget/photoScan/camera/photo_scan_camera.dart:46:35)
<asynchronous suspension>

It seems that as double is causing an error on line 118 of pigeon.dart.

static PreviewSize decode(Object result) {
    result as List<Object?>;
    return PreviewSize(
      width: result[0]! as double,
      height: result[1]! as double,
    );
  }

About your device

Brand Model OS
Apple iPhone 15 Pro 17.2.1

My flutter version

3.16.7

Thank you.

jt274 commented 5 months ago

Same. Appears to only be an iOS issue.

My error is camerawesome/pigeon.dart line 1283:28 from CameraInterface.getMinZoom.

g-apparence commented 5 months ago

Hi, sorry it's been fixed but not released on pubdev yet. Will do

sakyoyuto commented 5 months ago

Thank you!

jt274 commented 4 months ago

Was this released in the latest version? It's not mentioned in the changelog.

g-apparence commented 4 months ago

@jt274 yes forgot to mention it sorry. This has been fixed

sakyoyuto commented 4 months ago

Thank you very much, I was able to confirm the fix.

felipe1almeida commented 3 months ago

@g-apparence It seems we have the same issue. type 'int' is not a subtype of type 'double?' in type cast

pigeon.dart:1289 return (replyList[0] as double?)!;

awesome_zoom_selector.dart:27: minZoom = await CamerawesomePlugin.getMinZoom(); maxZoom = await CamerawesomePlugin.getMaxZoom();

Is there any fix planned for this?