[Solved] Cannot provide both a color and a decoration in Flutter
If you are seeing like this error color == null || decoration == null “Cannot provide both a color and a decoration\n To provide both, use \”decoration: BoxDecoration(color: color)\”.”
Here is way to solve it.
Oh, you got a mistake here, I surely said that you passed a color property inside the container and another color property on the decoration box of that container, and you are able to done framework confused enough. Sorry about that!
Table of Contents
Fix Cannot provide both a color and a decoration
Remove one color property from the inside container, gentlemen (its your choice ). If you only pass color to Boxdecoration, you are using the decoration property if it is not passed inside the container.
Error containing code

Container(
color: Colors.grey,
decoration: const BoxDecoration(color: Colors.grey),
child: Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
),
Solution

Container(
decoration: const BoxDecoration(color: Colors.grey),
child: Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
),
About Ambika Dulal
Lead Mobile App Developer and Tech Consultant specializing in Flutter, Dart, and Firebase.