I have an ExpansionTile
widget and it contains some children
, what I want is to prevent the ExpansionTile
from rebuilding its children when I expand it.
Is there any basic method or will I have to do some trick?
I have an ExpansionTile
widget and it contains some children
, what I want is to prevent the ExpansionTile
from rebuilding its children when I expand it.
Is there any basic method or will I have to do some trick?
just make this maintainState
value true
like this:
ExpansionTile(
maintainState: true,
children: [
...
]
)
Sure try to use automaticKeepAlive it will keep your widget alive without building again
If you want to keep it without building as a constant , you can use const type
For automaticKeepAlive check : https://api.flutter.dev/flutter/widgets/AutomaticKeepAliveClientMixin-mixin.html
Here more like this q & a