-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
gender is defined as an enum in Postgres, which accepts multiple values that could have {male, female, other}
Table
gender gender_enum[] DEFAULT '{female}',
Insert
gender': gender.map((e) => e.name).toList(),
I can see in the PgAdmin4 using a select query that displays gender as {male, female} value but when I use the select command in dart code it returns in _Uint8ArrayView format.
SELECT * FROM table
How can I solve this issue, please mention the best practices to deal with the Enum list.
Thank's in advance.
What I tried (current solution)
Uint8List uint8List = Uint8List.fromList(gender);
List<int> intListConverted = uint8List.toList();
String stringValue = String.fromCharCodes(intListConverted);
print(stringVlaue); output -> ��¸���male female other
if (stringValue.contains(GenderEnum.male.name)) {
genderList.add(GenderEnum.male);
} else if (stringValue.contains(GenderEnum.female.name)) {
genderList.add(GenderEnum.female);
} else if (stringValue.contains(GenderEnum.other.name)) {
genderList.add(GenderEnum.other);
}
Metadata
Metadata
Assignees
Labels
No labels