1

i have this code

 RefreshIndicator(
            key: _refreshIndicatorKey,
            onRefresh: onrefreh,//don't do anything
            child: TodoPage())

and TodoPage likes that

Widget build(BuildContext context) {
    print('tt');
    final todoBloc = TodoProvider.of(context);

    return Scaffold(
      appBar: AppBar(title: Text("Title")),
      body: Center(
        child: Column()
   ......
}

sometimes when i even touch the main page i can see 'tt' String twice on bebugconsole i think refreshindicator make todoPage rebuild and when i refresh definitely i can see two 'tt' result on debug console why they rebuild twice? and if i want only one time when i surely swipe the page to refresh

evergreen
  • 681
  • 10
  • 22
  • Why does it matter? This shouldn't have any impact on your app – Rémi Rousselet Aug 15 '19 at 11:34
  • 2
    i just wander and i think if app size is getting bigger i think it's not good because it rebuild twice – evergreen Aug 15 '19 at 11:43
  • 1
    and also in my case when widget be rebuilt there is streambuilder and that requests api(http.get(uri)) so everytime i refresh api is rqeusted twice – evergreen Aug 15 '19 at 12:11
  • That's unrelated and your fault. See https://stackoverflow.com/questions/52249578/how-to-deal-with-unwanted-widget-build – Rémi Rousselet Aug 15 '19 at 13:08
  • thanks i think this is also related to my problem but i also want to know why refreshindicator do that. i thnk scrollNotification.depth==0 this line make children's build methods rebuild. what if i change that condition and how can i? – evergreen Aug 16 '19 at 11:24

0 Answers0