Created
September 9, 2019 15:59
-
-
Save kleberandrade/f3e0f6e1903b47324de4e5ee1c5c659b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
final String tableStuff = 'stuff'; | |
final String columnId = '_id'; | |
final String columnDescription = 'stuffDescription'; | |
final String columnPicture = 'stuffPicture'; | |
final String columnDepartureDate = 'stuffDepartureDate'; | |
final String columnReturnDate = 'stuffReturnDate'; | |
final String columnFriendName = 'friendName'; | |
final String columnFriendPhone = 'friendPhone'; | |
class Stuff { | |
int id; | |
String stuffDescription; | |
String stuffPicture; | |
String stuffDepartureDate; | |
String stuffReturnDate; | |
String friendName; | |
String friendPhone; | |
Stuff( | |
{this.id, | |
this.friendName, | |
this.friendPhone, | |
this.stuffDescription, | |
this.stuffPicture, | |
this.stuffDepartureDate, | |
this.stuffReturnDate}); | |
Stuff.fromMap(Map map) { | |
id = map[columnId]; | |
friendName = map[columnFriendName]; | |
friendPhone = map[columnFriendPhone]; | |
stuffDescription = map[columnDescription]; | |
stuffPicture = map[columnPicture]; | |
stuffDepartureDate = map[columnDepartureDate]; | |
stuffReturnDate = map[columnReturnDate]; | |
} | |
Map<String, dynamic> toMap() { | |
Map<String, dynamic> map = { | |
columnFriendName: friendName, | |
columnFriendPhone: friendPhone, | |
columnDescription: stuffDescription, | |
columnPicture: stuffPicture, | |
columnDepartureDate: stuffDepartureDate, | |
columnReturnDate: stuffReturnDate | |
}; | |
if (id != null) { | |
map[columnId] = id; | |
} | |
return map; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment