Skip to content

tierecke/localized_sorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌍 localized_sorter

pub package License: MIT

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 than O.
  • In Estonian, Zambia appears incorrectly at the end of the list, even though Z is the 19th letter of the alphabet (between S and T).
  • In Swedish, Ä is often mixed in with A, 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 latest version of localized_sorter to your pubspec.yaml:

dependencies:
  localized_sorter: ^latest

About

Fix "alphabetical bugs" in your Flutter apps. This library provides locale-aware sorting that respects native alphabet orders and multi-character letters across European languages. Faster and more memory-efficient than standard normalization, it ensures 'niño' sorts correctly in Spanish and 'åland' sorts correctly in Swedish.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages