Converts a string to UTF-8 encoded bytes.
static Uint8List stringToBytes(String str) { return Uint8List.fromList(utf8.encode(str)); }