raiseOnNul function
Throws a FormatException if str contains U+0000, or returns str.
Implementation
String raiseOnNul(String where, String str) {
if (str.indexOf("\u0000") case var i when i >= 0)
throw FormatException("$where: unwanted U+0000", str, i);
return str;
}