Skip to content

Kotlin 2.0 Compatibility: Unable to Instantiate Message #5859

Answered by VelikovPetar
Polar-Points asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Polar-Points,

Thanks for the details - You are correct, I did some tests and the Message model is considered as InternalStreamChatApi because the channelInfo property and the ChannelInfo model are also marked with InternalStreamChatApi.
I am not sure if upgrading the SDK version to a newer one is a feasible option for you (since v6.0.0 the channelInfo is no longer internal), but if not, you should be able to use @OptIn(InternalStreamChatApi::class) on the enclosing class where you instantiate the Message object, which would suppress the error/warning. It is perfectly safe to instantiate the Message object - it is just not advised to read the channelInfo member. Because it is marked as…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@VelikovPetar
Comment options

Answer selected by Polar-Points
@Polar-Points
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants