Issue
I have not found any documentation about possibility built in Enum columns in Flutter ORM moor. What is the best way to create enum column? I want this:
enum PersistentType {
File,
Database
}
class Recipes extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get title => text().withLength(max: 16)();
TextColumn get instructions => text()();
EnumColumn get persType=> enum<PersistentType>().nullable()(); // TODO Not possible??
}
Solution
You can use Type Converter for enum or custom object.
doc:
https://moor.simonbinder.eu/docs/advanced-features/type_converters/
example:
https://github.com/simolus3/moor/issues/521
Answered By – wonpyohong
Answer Checked By – Katrina (FlutterFixes Volunteer)