I further explore and found out showTooltip method is not being called in initstate but yes it is being called on didupdatewidget. That's why on hot-reload and setState tooltip is being shown.
Purposed solution:
Calling _showTooltip in initState. I tested this and it is working fine.
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((Duration _) {
widget.routeObserver
?.subscribe(this, ModalRoute.of(context)! as PageRoute<dynamic>);
// Show the tooltip if it should be shown.
if (widget.show) {
_showTooltip();
}
});
}
facing an issue related to tooltip appearance, Tooltip does not appear until hot reload or setState called.
I further explore and found out
showTooltip
method is not being called in initstate but yes it is being called ondidupdatewidget
. That's why on hot-reload andsetState
tooltip is being shown.Purposed solution:
_showTooltip
in initState. I tested this and it is working fine.