I have a question i flutter in some named parameters like color: Or physics: in listviewbuilder the value is Colors.some color name in color and Neverscroll in physics My question is how to know that the attribute take this value although I tried to search in source code in flutter but i couldn't find out how Thanks a lot
Theses are known as named constructor. Check this class
class MyClass {
final int a;
final String b;
final double c;
MyClass({required this.a, required this.b, this.c = 1.0});
}
Once you like to use this class you need to provide data like
MyClass(a: 1, b: "");
Note here a and b are required but c is using default value. Also, you can make nullable variables.
A good start guide will be language-tour
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.