Надеюсь, этот код поможет вам. Это может быть написано более красивым способом, но я надеюсь, что вы поняли идею.
//Convert the color to hex, Save it in preferences
var myColor = Colors.blue;
var hex = '#${myColor.value.toRadixString(16)}';
//save Hex value in sharedpreference.
//get the hex value from shared preferences and convert it into color.
Color yourColor= hexToColor(colorStringFromSharedPreference);
Color hexToColor(String code) {
return Color(int.parse(code.substring(1, 7), radix: 16) + 0xFF000000);
}
Также, как предлагается в комментарии, вы также можете сохранить значение int цвета.
int myColorInteger = myColor.value
//store integer value in sharedpreference
и извлечение его с использованием конструктора Color
//retrieve intValue of color from sharedpreference and
Color myColor = Color(intValue)