Color getPrimary(int? key) { if (primary is MaterialColor) { return (primary as MaterialColor)[key!]!; } else { return primary; } }