Reputation: 13
Got the below error while trying to create an Onboarding screen while following a youtube tutorial. Does anyone know how to solve this error and what is the problem?
The named parameter 'visualDensity' isn't defined. dart(undefined_name_parameter)
Upvotes: 0
Views: 1459
Reputation: 13
I solved the above error and I'm adding the code snippet just in case someone wants to see the solved code.enter image description here
Upvotes: 1
Reputation: 1600
According to your image you are not placing the {} in the correct place. Where you have a purple bracket, place a comma and then add visual density property instead of placing it after ThemeData ends.
For your code:
theme: const ThemeData(
scaffoldBackgroundColor: Colors.white,
fontFamily: "Schyler",
textTheme: const TextT heme(......), //Notice only 1 bracket
visualDensity: VisualDensity.adaptivePlatformDensity,
) //And now close the ThemeData.
Upvotes: 0