readString method

Future<String?> readString(
  1. int length
)

Like readBytes, but returns an ASCII string.

Implementation

Future<String?> readString(int length) async {
  final bytes = await readBytes(length);

  if (bytes != null) {
    return String.fromCharCodes(bytes);
  } else {
    return null;
  }
}