The constructor returns type 'Color' that isn't of expected type 'MaterialColor'.

primarySwatch takes a ColorSwatch [which MaterialColor extends]. 
A swatch is a map of shades for a color (from [50] to [900]).

Colors.teal is a swatch, it includes all the different Color variations of teal,
of which teal[100] is just one.

Colors.teal[100] is an individual Color, it can't be assigned to a property that
expects a full swatch.

Hope this clarifies things, you can also take a look at the Colors documentation
(https://api.flutter.dev/flutter/material/Colors-class.html) for more details.

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source