Hide UTF-16 assumptions in the API. (#13)

* Avoid the API depending on the underlying data being random-access UTF-16 code units.

In this case, don't return `codeUnits` as a list of integers, but explicitly say `utf16CodeUnits` and return them as an iterable. That can be implemented as efficiently as possible on, say, a UTF-8 byte array.

* Also use .characters in rest of example.
5 files changed
tree: 59710de29a2ec810fa6cdc21e0643d9c3e7dd008
  1. .vscode/
  2. benchmark/
  3. example/
  4. lib/
  5. test/
  6. third_party/
  7. .gitignore
  8. .travis.yml
  9. analysis_options.yaml
  11. CHANGELOG.md
  13. pubspec.yaml
  14. README.md

pub package Build Status

NOTE: This package is considered experimental, and breaking API changes are to be expected.

Characters are strings viewed as sequences of user-perceived characters, also know as Unicode (extended) grapheme clusters.

The Characters class allows access to the individual characters of a string, and a way to navigate back and forth between them using a CharacterRange.