I am new to dart and flutter, I am trying to use an inline function to return a value.
SizedBox(
height: _getheight()
),
double _getheight(){
//do some stuff
return 20.0;
}
//WORKS
SizedBox(
height: (){return 20.0;}
),
//(Won't build)
error: The argument type 'double Function()' can't be assigned to the parameter type 'double'.
SizedBox(
height: (){return 20.0;} as double
),
--builds but fails during runtime error: type '() => double' is not a subtype of type 'double' in type cast