sassLength property Null safety

int sassLength
late, final

Sass's notion of the length of this string.

Sass treats strings as a series of Unicode code points while Dart treats them as a series of UTF-16 code units. For example, the character U+1F60A, Smiling Face With Smiling Eyes, is a single Unicode code point but is represented in UTF-16 as two code units (0xD83D and 0xDE0A). So in Dart, "a😊b".length returns 4, whereas in Sass str-length("a😊b") returns 3.

This returns the same value as text.runes.length, but it's more efficient.

Implementation

late final int sassLength = text.runes.length;