This is my code:
@override
Widget build(BuildContext context) {
print('It is being rebulid');
print(_value.value);
return Scaffold(
backgroundColor: ColorManager.white,
body: ValueListenableBuilder<int>(
valueListenable: _value,
builder: (context, value, child) {
return StreamBuilder<FlowState>(
stream: _forgotEmailViewModel.outputState,
builder: (context, snapshot) {
print(snapshot.data);
return snapshot.data?.getScreenWidget(
context, _getContentWidget(), () {}) ??
_getContentWidget();
},
);
},
));
}
As I can understand about ValueListenableBuilder, it only builds the method inside it when the value changes. In my application there is a textfield. As the keyboard pops up or closes, the build method is called and I get the two print statements in the console. What I don't understand is that since I do not change the value then why does the StreamBuilder is also rebuild (because I also got the value of my snapshot in the console).
I do not want my stream builder to rebuild every time the keyboard is opened or closed.
Can someone please help me here?