I opened an old Dart project, and I get a warning about StringDecoder being undefined. How do I update my code? What do I use instead of StringDecoder ?
Example code:
response.transform(new StringDecoder()).toList().then((list) {
print('$_client results...');
print('${list.join()}');
client.close();
});
The StringEncoder and StringDecoder classes have been removed from
dart:io.
Instead, import dart:convert and use the decoders of the Encodings.
Examples:
new StringDecoder() -> utf8.decoder
new StringDecoder(encoding) -> encoding.decoder
new StringEncoder() -> utf8.encoder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With