i am developing a todo app that contains a tag part and a task part. each tag contains a title and a color so i needs to store tag color in sqlite db. here is my tag table columns :
db.execute('''
create table tags (
id integer primary key autoincrement,
title text not null,
color text not null
)
''');
and here i send my tag model to insert db method :
new TagModel(
title: _addTagTitleController.text,
color: _currentColor.value.toString(),
),
any idea will be greate.
CodePudding user response:
You can save the int value of the color in the db.
int value = Colors.white.value; //save this in your database.
Then for using it again, retrieve the int value and do this,
Color newColor = Color(value); //value refers to the int value saved in the database