Let us say that I need access to by "categories stream" on a page. Now the page is modularised such that :
Widget/Page A:
build() {
subWidgetA,
subWidgetB,
subWidgetC,
subWidgetD,
}
Now, I need my categories streams inside subWidget A and subWidget D. Should I just declare the streambuilder as the first child inside my build() or declare that streambuilder inside the respective subwidgets.
Approach 1:
build() {
StreamBuilder() {
subWidgetA (data from asyncsnapshot),
subWidgetB,
subWidgetC,
subWidgetD (data from asyncsnapshot),
}
}
Approach 2:
build() {
subWidgetA,
subWidgetB,
subWidgetC,
subWidgetD,
}
subWidgetA() {
StreamBuilder categories () {
}
}
subWidgetD() {
StreamBuilder categories () {
}
}
Which approach is better and why ?? Thanks in advance!