High-performance, zero-allocation, linguistic string comparison for Flutter and Dart.
In a global application, standard string sorting (list.sort()) relies on Unicode codepoint values. This creates "alphabetical bugs" where words appear in the wrong order according to a user's native language.
- In Spanish, Niño often appears incorrectly after Oscar because the Unicode value of
Ñis higher thanO. - In Estonian, Zambia appears incorrectly at the end of the list, even though
Zis the 19th letter of the alphabet (betweenSandT). - In Swedish,
Äis often mixed in withA, despite being a completely distinct letter at the end of the alphabet.
localized_sorter solves this by implementing specific Linguistic Rules for 17+ languages.
It is optimized for mobile performance using a Zero-Allocation strategy. Instead of creating new string objects (which triggers Garbage Collection and frame drops), the algorithm uses pointers to compare character codes directly in memory.
Add the latest version of localized_sorter to your pubspec.yaml:
dependencies:
localized_sorter: ^latest