🌍 localized_sorter
High-performance, zero-allocation, linguistic string comparison for Flutter and Dart.
🧐 The Problem
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.
💡 The Solution
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.
🛠️ Installation
Add the following to your pubspec.yaml:
dependencies:
localized_sorter: ^0.1.0