The Dart string has length 9, and contains all nine code units. NUL characters are perfectly valid in a Dart string.
They are not valid in C strings though, where they mark the end of the string.
When printing, the string is eventually converted to a C-string to call the system library's output function. At that point, the system library sees only the NUL character and prints nothing.
Try:
main() { print("ab\x00cd"); } // prints "ab".
The String.length function works entirely on the Dart String object, and doesn't go through the C strlen function. It's unaffected by the limits of C.
Arguably, the Dart print functionality should detect NUL characters and print the rest of the string anyway.