When I try to set Colors.black 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?
- 4 years ago
theme: ThemeData(
primarySwatch: Colors.black
),
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
use,
primaryColor: Colors.black, primaryColorLight: Colors.grey, accentColor: Colors.blue,
Hot Questions