Last active
March 1, 2020 18:47
-
-
Save christianalfoni/790eaec80ee6f3d2feb07ff25dbd7902 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppleSubscription { | |
String productId; | |
int purchaseDate; | |
int expiresDate; | |
bool isActive; | |
AppleSubscription.fromJSON(Map<String, dynamic> json) : | |
productId = json["productId"], | |
purchaseDate = json["purchaseDate"], | |
expiresDate = json["expiresDate"], | |
isActive = json["isActive"]; | |
} | |
/* | |
A Profile should have this data shape on the property "appleSubscriptions": | |
{20594975: {isActive: true, expiresDate: 1583082002000, productId: test, purchaseDate: 1583081702000}} | |
Where each key as an AppleSubscription | |
*/ | |
appleSubscriptions = json["appleSubscriptions"] == null ? Map() : json['appleSubscriptions']; | |
/* | |
How do I convert this? I have tried every possible approach to casting, mapping to MapEntry etc. I am just not able | |
to convert it. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment