extension_utilities 1.2.1
extension_utilities: ^1.2.1 copied to clipboard
A library of extension utilities on existing dart core
1.2.0 #
Added #
-
Enhanced
IntExtensionwith numerous utility methods:isEven/isOddgetters for quick parity checksisPrimegetter to check if a number is primefactorial()method for calculating factorialstoRoman()for converting integers to Roman numerals- Time-related getters:
milliseconds,seconds,minutes,hours,days isLeapYeargetter for checking leap yearstoWords()method for converting numbers to English words (up to billions)padLeft()method for zero-padding numbersdivisorsgetter for finding all divisors of a numbergcd()method for finding Greatest Common Divisorlcm()method for finding Least Common Multiple
-
Added new Set utilities:
whereSet- Returns a new set with elements that satisfy the given predicatemapSet- Returns a new set with elements transformed by the given mapperany- Returns true if any element matches the given predicateall- Returns true if all elements match the given predicatenone- Returns true if no elements match the given predicateaddIfNotNull- Returns a new set with an element added if it's not nulladdAllIfNotNull- Returns a new set with all non-null elements addedfirstWhereOrNull- Returns the first element matching a predicate or nullslice- Returns a new set with elements at specified indicescontainsAll- Checks if set contains all elements from another iterablecontainsAny- Checks if set contains any elements from another iterablegroupBy- Groups elements into a map of sets by a key functiondistinctBy- Removes duplicates based on a key functionchunked- Splits the set into chunks of given sizesorted- Returns a new set with elements sorted by a compare functionsortedBy- Returns a new set sorted by a key functionsortedByDescending- Returns a new set sorted in descending order by a key function
-
Enhanced
NumExtensionwith comprehensive utility methods:-
Number Formatting
formatted- Adds thousand separators (e.g., 1,234,567)toCurrency- Formats number as currency with locale supportpercentage- Formats number as percentageformatBytes- Human-readable byte format (e.g., 1.5 GB)
-
Mathematical Utilities
isEven- Check if number is evenisOdd- Check if number is oddisPositive- Check if number is positiveisNegative- Check if number is negativeisZero- Check if number is zeroisInteger- Check if number is an integerclamp- Restrict number to a rangeisBetween- Check if number is in rangeisPrime- Check if number is primefactorial- Calculate factorial
-
Range Utilities
until- Create range (exclusive)to- Create range (inclusive)
-
Conversion Utilities
toRoman- Convert to Roman numeralstoRadians- Convert degrees to radianstoDegrees- Convert radians to degreestoOrdinal- Convert to ordinal string (1st, 2nd, 3rd, etc.)
-
-
Added new List Extensions:
elementAtOrNull- Returns the element at index or null if out of boundssingleWhereOrNull- Returns single matching element or null if none/multiple foundreduceOrNull- Returns reduced value or null if list is emptyindexWhereOrNull- Returns first matching index or null if not foundlastIndexWhereOrNull- Returns last matching index or null if not foundindexOfOrNull- Returns first index of element or null if not foundlastIndexOfOrNull- Returns last index of element or null if not foundremoveLastOrNull- Removes and returns last element or null if emptyremoveAtOrNull- Removes and returns element at index or null if out of boundsremoveOrNull- Removes first occurrence and returns success boolean
1.1.0 #
- add .ms, .millisecond, .s, .seconds, .mins, .minutes, .hr, .hours, on num that returns [Duration]
1.0.2 #
- add .toInt() & .tryToInt() method on [String]
- add .toDouble() & .tryToDouble() methods on [String]
- add .toBool() & .tryToBool() methods on [String]
1.0.1 #
- add .random() method on [int]
- add .random() & .randomOrNull() methods on [Set]
1.0.0 #
- Initial Release
- add .random() & .randomOrNull() methods on [List]