Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sakyoyuto opened this issue Jan 18, 2024 · 7 comments
Closed

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

sakyoyuto opened this issue Jan 18, 2024 · 7 comments

Comments

@sakyoyuto
Copy link

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
Copy link

jt274 commented Jan 23, 2024

Same. Appears to only be an iOS issue.

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

@g-apparence
Copy link
Collaborator

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

@sakyoyuto
Copy link
Author

Thank you!

@jt274
Copy link

jt274 commented Feb 26, 2024

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

@g-apparence
Copy link
Collaborator

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

@sakyoyuto
Copy link
Author

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

@felipe1almeida
Copy link

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants