utilities library

Functions

byteToHex(int byte) String
equalValue<T, K>(Iterable<T> items, K? getValue(T a), {bool equalityCheck(K? a, K? b)?}) → K?
Checks that all the retrieved values for an item are the same. If they're the same, it returns the equal value, otherwise it'll return null. A custom equalityCheck can be provided for objects that don't override their equality operator or need more sophisticated rules of equality (for example if your K is a collection). TODO: have two functions; one to check is all are equal, another to get the value?
formatUuid(Uint8List buffer) String
Adapted from: https://github.com/daegalus/dart-uuid/blob/main/lib/parsing.dart
iterableEquals<T>(Iterable<T>? list1, Iterable<T>? list2, {bool equalityCheck(T a, T b)?}) bool
Check if an iterable is equal to another iterable. Iterables are considered equal if they have the same number of values and each of those values are equal. A custom equalityCheck can be provided for objects that don't override their equality operator or need to be deemed equal based on varying application logic.
listEquals<T>(List<T>? a, List<T>? b) bool
setEquals<T>(Iterable<T>? it1, Iterable<T>? it2) bool
Returns true if all the elemnts in iterable1 are contained in iterable2. Assumes there are no dupes in either iterable.
szudzik(int a, int b) int
Szudzik's function for hashing two ints together
uuidVariant2(Uint8List uuidBuffer) Uint8List