How to debounce Textfield onChange in Dart?

后端 未结 9 1197
攒了一身酷
攒了一身酷 2020-12-03 04:49

I\'m trying to develop a TextField that update the data on a Firestore database when they change. It seems to work but I need to prevent the onChange event to fire multiple

9条回答
  •  隐瞒了意图╮
    2020-12-03 05:12

    Have a look at EasyDebounce.

    EasyDebounce.debounce(
      'my-debouncer',                 // <-- An ID for this particular debouncer
       Duration(milliseconds: 500),    // <-- The debounce duration
      () => myMethod()                // <-- The target method
    );
    

提交回复
热议问题