Created
January 16, 2022 05:37
-
-
Save teerasej/3f937f47bada4186b203939857c9085c to your computer and use it in GitHub Desktop.
Good guideline to convert JSON (map) to instance of a class in Flutter/Dart app
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 AnnouncementMessage { | |
String? auctionSequenceId; | |
String? annoucementText; | |
AnnouncementMessage({this.auctionSequenceId, this.annoucementText}); | |
static AnnouncementMessage fromMap(Map<String, dynamic> json) { | |
return AnnouncementMessage.fromJson(json); | |
} | |
factory AnnouncementMessage.fromJson(Map<String, dynamic> json) { | |
return AnnouncementMessage( | |
auctionSequenceId: json['auction_sequence_id'], | |
annoucementText: json["annoucement_text"], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment