I'm uploading some user data into firebase's database, but one of the variables is the background color, which is of type Color.
Unhandled Exception: Invalid argument: Instance of 'Color' How can I upload that? Until now I've only used the type string in the collection.
This is what I'm using:
final Color _backgroundColor; ... onPressed: () { _firestore.collection('users').add({ 'backgroundColor': _backgroundColor, }) } What type (for the variable Color) should I choose in the collection? Or should I change something in the code? The code does work though, because for the variables of type string it didn't throw an exception.
Color, so you have to convert it to text or some other value which you can decode later when you fetch it.