How to get and receive data from Websocket in Flutter

Viewed 185

How to parse and json to websocket data in flutter

StreamBuilder(
                  stream: _channel.stream,
                  builder: (context, snapshot) {
                    return ListView.builder(
                        shrinkWrap: true,
                        itemCount: snapshot.data.hashCode.bitLength,
                        scrollDirection: Axis.vertical,
                        physics: NeverScrollableScrollPhysics(),
                        itemBuilder: (context, index){
                          // final List documents = snapshot.data.hashCode.bitLength as List;
                          // final Map<String, dynamic> doc = snapshot.data.hashCode.bitLength as Map<String, dynamic>;
                          // final course = snapshot.data!.hashCode.bitLength;
                          return Card(
                            child: Container(
                              child: Column(
                                children: [
                                  Text('Recieve'),
                                  Text(snapshot.hasData ? '${snapshot.data}' : '')
                                ],
                              ),
                            ),
                          );
                        });
                  },
                ),

i have get data and show in list inside screen but how to parse these data to websocket using json to the server

1 Answers
Related