Question Detail

type 'color' is not a subtype of type 'materialcolor' flutter

5 years ago Views 5491 Visit Post Reply

When I try to set primarySwatch color, I got error: type 'Color' is not a subtype of type 'MaterialColor' in flutter. 

How to solve Color is not a subtype of MaterialColor?

Thread Reply

Correct Answer

alex levine

- 5 years ago

theme: ThemeData(



thats way you are getting error type 'Color' is not a subtype of type 'MaterialColor'

primarySwatch is a banch of multiple colors for deffrant part like primarySwatch has color for status bar Titlebar etc.
you are tring to set single colors for primarySwatch. 

if you want to setup deffrente colors for your own dont use primarySwatch


primaryColorLight: Colors.grey,