x_unique_list 1.1.1
x_unique_list: ^1.1.1 copied to clipboard
A Flutter - Dart package that provides a list with unique elements based on a custom uniqueness condition.
Changelog #
1.1.1 #
- 📝 README.md
1.1.0 #
✨ Added #
- Added
addOrReplace():- Adds item if unique key does not exist.
- Replaces existing item if key matches but value differs.
- Returns
falseif identical item already exists (no-op).
- Added
addAllOrReplace():- Batch version of
addOrReplace. - Returns count of items added + replaced.
- Batch version of
🔧 Improved #
remove():- No longer relies on
==for removal. - Now removes based on
uniqueCondition→ more predictable behavior.
- No longer relies on
removeWhere():- Now correctly keeps
_uniqueItemsSetin sync with_itemsList. - Fixes potential data corruption bug.
- Now correctly keeps
firstWhere():- Removed exception-based flow.
- Now uses safe iteration → avoids unnecessary try/catch overhead.
where():- Returns
Iterable<T>instead ofList<T>to avoid unnecessary allocation.
- Returns
addAll():- Now accepts
Iterable<T>instead ofList<T>→ more flexible API.
- Now accepts
insertAll():- Improved documentation and clarified complexity behavior.
unmodifiableItems:- Uses
List<T>.unmodifiableexplicitly.
- Uses
⚡ Performance #
- Reduced unnecessary allocations:
where()no longer creates a new list.
- Improved predictability of operations by aligning all mutations with
_uniqueItemsSet. - Documented precise time complexity for all public methods.
🐛 Fixed #
- Critical bug where
removeWhere()did not update_uniqueItemsSet. - Potential inconsistency between
_itemsListand_uniqueItemsSet. - Edge cases in
remove()where item existed in set but not properly removed from list.
🧠 Behavioral Changes #
remove(T item):- Now removes based on
uniqueConditioninstead of relying on object equality.
- Now removes based on
addOrReplace():- Explicitly distinguishes between:
- add
- replace
- no-op (identical item)
- Explicitly distinguishes between:
📚 Documentation #
- Added detailed time complexity annotations for all methods.
- Improved method-level comments for clarity and maintainability.
1.0.2 #
🔄 Changes: #
- Improved
README.mdto provide clearer documentation and examples.- Added detailed sections for installation, usage, and methods.
- Updated examples and explanations for better clarity.
1.0.1 Support for Dart and Flutter 🛠 #
🔄 Changes: #
- Added support for both Dart and Flutter environments.
- Improved compatibility and removed unnecessary Flutter dependencies.
- Fixed minor bugs in list manipulation functions.
1.0.0 Initial Release 🎉 #
✨ Features: #
XUniqueListwith uniqueness enforcement viauniqueCondition.- Core operations:
add,addAll,insert,remove,replaceOne, etc.
🛠 Utility Functions: #
contains,clear,length,isEmpty,isNotEmpty.
📦 Access: #
items(modifiable)unmodifiableItems
✅ Testing: #
- Unit tests for core functionality.