Hi I’m a beginner on Flutter is there any way to initialize a varirable with another variable that’s declared above it ?
2
You can do lazy initialization by adding late on second variable declaration like
late
Foo foo = Foo(); late int data= foo.value;
Yes you can by initializing the second variable in the initState() Function in statefulWidget class .
initState()
statefulWidget
Click here to cancel reply.
2
Answers
You can do lazy initialization by adding
late
on second variable declaration likeYes you can by initializing the second variable in the
initState()
Function instatefulWidget
class .