adaptyteam / AdaptySDK-Flutter

SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
96 stars 17 forks source link

converting object to an encodable object failed #90

Closed SerSerch closed 1 year ago

SerSerch commented 1 year ago

please add methodіs: AdaptyProfile toJson AdaptyAccessLevel toJson AdaptySubscription toJson AdaptyNonSubscription toJson

final AdaptyProfile? adaptyProfile = await adapty.getProfile();
final dataJSON = jsonEncode(adaptyProfile);

// ERROR converting object to an encodable object failed: Instance of 'AdaptyProfile'

final AdaptyAccessLevel? accessLevel = adaptyProfile.accessLevels['premium'];
final accessLevelJSON = jsonEncode(accessLevel);

// ERROR converting object to an encodable object failed: Instance of 'AdaptyAccessLevel'

versions:

Flutter Channel stable, 3.10.6

adapty_flutter:
version: "2.4.3"
x401om commented 1 year ago

Hey, @SerSerch! For now we don't have any plans not to implement nor to support these methods. Could you please clarify why there is a need to convert SDK objects to JSON?

SerSerch commented 1 year ago

@x401om Hi! to send them to back-end. maybe it's not the best idea, but it would be great to have that option.

x401om commented 1 year ago

@SerSerch I've discussed your query with my colleagues, and after careful consideration, we have decided not to integrate these methods into the SDK as they do not affect the core functionality and will require constant support from our side when changing models.

However, you can implement these methods by yourself and send data to the server.

Thank you for your understanding.