Reputation: 1585
I'm not clear about the differences between socket.write vs socket.add
I observed both are different but not sure how it is different and what are the differences.
Please clarify
Thanks.
Upvotes: 2
Views: 252
Reputation: 657929
add(List<int> data)
https://api.dartlang.org/stable/2.0.0/dart-io/IOSink/add.html takes a list of int
and sends them as byte data,
while write(Object obj)
https://api.dartlang.org/stable/2.0.0/dart-io/IOSink/write.html accepts any value that it converts to a string (calls .toString()
on the passed value) and sends the resulting string.
Upvotes: 3