'websocket stream debounceTime not working in flutter

Hi I need to add some delay on my IOWebSocketChannel streem to slow it down. I used stream.debounceTime(Duration(seconds: 4)) to call the builder method every 4 seconds, but the builder method never runs. If I remove debounceTime, StreamBuilder works properly. Please help me what is wrong with debounceTime and where it should be?

 class _HomeState extends State<Home> {
  IOWebSocketChannel? channel;

  @override
  void initState() {
    super.initState();
    channel?.sink.close();
    channel = IOWebSocketChannel.connect(
      Uri.parse(ApiEndPoint.socketApi),
    );
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      resizeToAvoidBottomPadding: false,
      appBar: AppBar(
        title: Text('price'),
      ),
      body: Column(
        children: <Widget>[
          StreamBuilder(
            // use debounceTime to run builder method every 4 seconds
            stream: channel!.stream.debounceTime(Duration(seconds: 4)),
            builder: (context, snapshot) {
              print(snapshot);
              return createMyList(snapshot.data);
            },
          )
        ],
      ),
    );
  }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source