diff --git a/lib/pigeon.dart b/lib/pigeon.dart index bffdfa9f..a8679a62 100644 --- a/lib/pigeon.dart +++ b/lib/pigeon.dart @@ -1264,6 +1264,14 @@ class CameraInterface { } } + double safelyRetrieveAndCastFirstValue(List replyList) { + if (replyList[0] is int) { + return (replyList[0] as int).toDouble(); + } else { + return (replyList[0] as double?)!; + } + } + Future getMinZoom() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraInterface.getMinZoom', codec, @@ -1286,7 +1294,7 @@ class CameraInterface { message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as double?)!; + return (safelyRetrieveAndCastFirstValue(replyList))!; } } @@ -1312,7 +1320,7 @@ class CameraInterface { message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as double?)!; + return (safelyRetrieveAndCastFirstValue(replyList))!; } }