helper/helper library

Helper functions used for extension methods. See heart.dart for more extensive documentation.

Constants

kWhitespaceCodes → const List<int>
Decimal form. Used for words.

Functions

ascendingList<T>(Iterable<T> it) List<T>
Regular sorted list.
averageString(String s) String
String from average of character codes.
backwardsList<T>(Iterable<T> l) List<T>
Reversed, return List.
backwardsString(String s) String
Reverse a String.
bigContains(Iterable l, dynamic v) bool
Checks if iterable contains element with bigEquals
bigEquals(dynamic a, dynamic b) bool
Check for equality of multiple data types
chr(int code) String
Get character from character code
chrs(Iterable<int> characterCodes) String
Get a String from character codes
concatLists<T>(Iterable<Iterable<T>> lists) List<T>
Combine lists into one.
concatStrings(Iterable<String> l) String
Combine Strings into one.
countList<T>(Iterable<T> it, T element) int
Count number of occurrences in an iterable.
countString(String sub, String original) int
Count number of occurrences in a String.
cycleList<T>(int n, Iterable<T> it) List<T>
Repeat elements of a list n times
deepContains(Iterable l, dynamic v) bool
Uses deepEquals to check if iterable contains a given element.
deepEquals(Object? e1, Object? e2) bool
Check for equality of multiple data types, including nested iterables.
descendingList<T>(Iterable<T> it) List<T>
Reversed sorted list.
dropList<T>(int n, Iterable<T> l) List<T>
Drop first n elements.
dropString(int n, String s) String
Drop first n characters.
dropWhileList<T>(bool dropFunction(T sub), Iterable<T> it) List<T>
Drop first n elements that meet criteria.
dropWhileString(bool dropFunction(String sub), String s) String
Drop first n characters that meet criteria.
elemIndicesList<T>(T element, Iterable<T> it) List<int>
List of every index of element in it
elemIndicesString(String sub, String original) List<int>
List of every index of sub in original
filterList<T>(bool filterFunction(T sub), Iterable<T> original) List<T>
Only keep elements that meet criteria
filterString(bool filterFunction(String sub), String original) String
Only keep characters that meet criteria
greaterThanIterable<T>(Iterable<T> it1, Iterable<T> it2) bool
For > and < operators for Iterables
greaterThanListNum<num>(Iterable<num> it1, Iterable<num> it2) bool
To compare Strings by code units.
greaterThanString(String s1, String s2) bool
Compare Strings by code units
groupByList<T>(bool groupFunction(T a, T b), Iterable<T> it) List<List<T>>
Group consecutive elements together if they meet criteria.
groupByString(bool groupFunction(String a, String b), String s) List<String>
Group characters together if they meet criteria.
groupList<T>(Iterable<T> it) List<List<T>>
Group consecutive equal elements together.
groupString(String s) List<String>
Group consecutive characters together if they are equal.
headList<T>(Iterable<T> it) → T?
Returns first element.
headString(String s) String?
Returns first character.
incrementString(String s, int n) String
Increment or decrement Strings, used for ^ operator.
initsList<T>(Iterable<T> it) List<List<T>>
Returns a List of Lists by adding one element at a time.
initsString(String s) List<String>?
Returns a List of Strings by adding one character at a time.
insertInOrder<T>(T n, Iterable<T> it) List<T>
Insert an element before the first greater element
insertInOrderString(String sub, String original) String
Insert a character before the first greater character
intercalateList<T>(Iterable<T> sub, Iterable<Iterable<T>> it) List<T>
Insert element between other elements and concatenate.
intercalateString(String s, Iterable<String> l) String
Insert a String between other Strings and concatenate.
interleaveList<T>(Iterable<T> it1, Iterable<T> it2) List<T>
Join two iterables by taking turns.
interleaveString(String s1, String s2) String
Join two Strings by taking turns.
intersperseList<T>(T v, Iterable<T> it) List<T>
Insert an element between other elements
intersperseString(String i, String original) String
Insert character between other characters
isLowerCase(String s, bool ignoreSymbols) bool
Check if characters of a String are lowercase.
isUpperCase(String s, bool ignoreSymbols) bool
Check if characters of a String are uppercase.
lastString(String s) String?
Returns last character.
lessThanString(String s1, String s2) bool
Compare Strings by code units
letterCount(String original, bool keepWhitespace) int
Count characters with or without whitespace.
letters(String s, bool keepWhitespace) List<String>
Split a String into a List of characters.
listAverage(Iterable<num> it) double
Average (mean) of numbers.
listIntersect<T>(Iterable<T> original, Iterable<T> input) List<T>
Keep only elements from input
listNub<T>(Iterable<T> original, [Iterable<T>? itemsToNub]) List<T>
Remove duplicate elements.
listSubtract<T>(Iterable<T> original, Iterable<T> sublist) List<T>
Subtract elements one at a time
listSubtractAll<T>(Iterable<T> original, Iterable<T> sublist) List<T>
Subtract all elements that are in sublist
nums(int a, [int? b, int? step]) List<int>
Generate a List of integers
productNum<T extends num>(Iterable<T> l) → dynamic
Multiply all elements.
productOfElements(Iterable<num> l) num
Multiply elements together
removeWhitespace(String s) String
Remove all whitespace from a String
replaceAllList<T>(Iterable<T> it, T from, [T? to]) List<T>
Delete all occurrences, or replace with to.
replaceList<T>(Iterable<T> it, bool replaceAll, T from, [dynamic to]) List<T>
Delete first occurrence, or replace with to
reversedSortedString(String s) String
Sort String in descending order.
riffleInList<T>(Iterable<T> it) List<T>
Split in half, interleave second half first.
riffleInString(String s) String
Split in half, interleave second half first.
riffleOutList<T>(Iterable<T> it) List<T>
Split in half, interleave together.
riffleOutString(String s) String
Split in half, interleave together.
shuffledList<T>(Iterable<T> it, bool cryptographicallySecure) List<T>
Return a shuffled List.
shuffledString(String s, bool cryptographicallySecure) String
Return a shuffled String.
sortedString(String s) String
Sort string by character codes.
splitAtList<T>(int n, Iterable<T> it) List<List<T>>
Split iterable into two.
splitAtString(int n, String s) List<String>
Split string into two.
stringAny(bool anyFunction(String sub), String s) bool
Check if any characters meet criteria
stringEvery(bool allFunction(String element), String s) bool
Check if every character meets criteria
stringIntersection(String original, String input) String
Keep only characters from input
stringNub(String s, String? charactersToNub) String
Remove duplicate characters.
stringSubtract(String original, String charsToDelete) String
Subtract characters one at at ime from charsToDelete
stringSubtractAll(String original, String charsToDelete) String
Subtract all characters that are in charsToDelete
sumNum<T extends num>(Iterable<T> l) → dynamic
Sum elements.
tailList<T>(Iterable<T> it) List<T>?
Returns everything but the first element.
tailsList<T>(Iterable<T> l) List<List<T>>
Returns everything but first element.
tailsString(String s) List<String>
Returns a list of lists by removing one character at a time.
tailString(String s) String?
Returns everything but the first character.
toStringList<T>(Iterable<T> l) List<String>
Convert all elements to Strings.
unionList<T>(Iterable<T> original, Iterable<T> input) List<T>
Get new elements from input
unionString(String original, String input) String
Get new characters from input.
unwords(Iterable<String> listOfWords) String
Combines Strings into one with spaces in between.
wordCount(String s) int
Count number of words separated by whitespace.
words(String original) List<String>
Separate a String into a List of words.
zip2<T>(Iterable<Iterable<T>> it, dynamic zipFunction(T a, T b)) List
Combine elements of two iterables into pairs and perform a function between them.
zip3<T>(Iterable<Iterable<T>> it, dynamic zipFunction(T a, T b, T c)) → dynamic
Combine elements of three iterables into pairs and perform a function between them.
zip4<T>(Iterable<Iterable<T>> it, dynamic zipFunction(T a, T b, T c, T d)) → dynamic
Combine elements of four iterables into pairs and perform a function between them.
zipList<T>(Iterable<Iterable<T>> it) List<List<T>>
Combine list elements into pairs