_common library

Enums

StringCaseType
Enum for different string case types.

Extensions

ConvertOnStringCaseTypeExtension on StringCaseType
DataRefModelExtension on DataRefModel
FirstWhereOrNullOnIterableExtension on Iterable<T>
FirstWhereOrNullOnListExtension on List<T>
FirstWhereOrNullOnMapExtension on Map<K, V>
FirstWhereOrNullOnSetExtension on Set<T>
GenericTypeOnIterableExtension on Iterable<T>
GenericTypeOnMapExtension on Map<K, V>
JoinWithLastSeparatorOnIterableExtension on Iterable
MapIOnIterableExtension on Iterable<A>
MapIOnListExtension on List<A>
MapIOnMapExtension on Map<A1, A2>
MapIOnSetExtension on Set<A>
MapKeysAndValyesOnMapExtension on Map<K1, V1>
MapWithDefaultOnMapExtension on Map<K, V>
MaybeAddToIterableExtension on Iterable<T>
MaybeAddToListExtension on List<T>
MaybeAddToMapExtension on Map<T1, T2>
MaybeAddToSetExtension on Set<T>
MiscUtilsOnStringExtension on String
NonNullKeysOnMapExtension on Map<K?, V>
NonNullsOnMapExtension on Map<K?, V?>
NonNullValuesOnMapExtension on Map<K, V?>
NullIfEmptyOnIterableExtension on Iterable<T>
NullIfEmptyOnListExtension on List<T>
NullIfEmptyOnMapExtension on Map<T1, T2>
NullIfEmptyOnQueueExtension on Queue<T>
NullIfEmptyOnSetExtension on Set<T>
NullIfEmptyOnStringX on String
SecondToNinthElementOnIterableExtension on Iterable<T>
SetNestedValueOnMapExtension on Map
StringCaseConversionsOnStringExtension on String
TakeLastOnIterableExtension on Iterable<String>
ToClassOnTFieldRecordExtension on TFieldRecord
ToMapOnIterableExtension on Iterable<MapEntry<K, V>>
ToTrimmedOrNullOnObjectExtension on Object
TraverseMapOnMapExtension on Map<K, V>
TryMergeOnIterableExtension on Iterable<Iterable<T>?>
TryOrNullOnFunctionExtension on Function
TryReduceOnIterableExtension on Iterable<T>
UniqueOnMapEntryIterableExtension on Iterable<MapEntry<K, V>>
ValueOfOnEnumExtension on Iterable<T>

Constants

CAMEL_CASE → const String
A key representing camel case.
CAMEL_CASE_EXAMPLE → const String
Camel case example.
LOWER_DOT_CASE → const String
A key representing lower dot case.
LOWER_DOT_CASE_EXAMPLE → const String
Lower dot case example.
LOWER_KEBAB_CASE → const String
A key representing lower kebab case.
LOWER_KEBAB_CASE_EXAMPLE → const String
Lower kebab case example.
LOWER_SNAKE_CASE → const String
A key representing lower snake case.
LOWER_SNAKE_CASE_EXAMPLE → const String
Lower snake case example.
PASCAL_CASE → const String
A key representing pascal case.
PASCAL_CASE_EXAMPLE → const String
Pascal case example.
PATH_CASE → const String
A key representing path case.
PATH_CASE_EXAMPLE → const String
Path case example.
T_CAMEL_CASE_STRING → const String
T_LOWER_CASE_STRING → const String
T_LOWER_KEBAB_CASE_STRING → const String
T_LOWER_SNAKE_CASE_STRING → const String
T_PASCAL_CASE_STRING → const String
T_SEARCHABLE_STRING → const String
T_UPPER_CASE_STRING → const String
T_UPPER_KEBAB_CASE_STRING → const String
T_UPPER_SNAKE_CASE_STRING → const String
UPPER_DOT_CASE → const String
A key representing upper dot case.
UPPER_DOT_CASE_EXAMPLE → const String
Upper dot case example.
UPPER_KEBAB_CASE → const String
A key representing upper kebab case.
UPPER_KEBAB_CASE_EXAMPLE → const String
Upper kebab case example.
UPPER_SNAKE_CASE → const String
A key representing upper snake case.
UPPER_SNAKE_CASE_EXAMPLE → const String
Upper snake case example.

Properties

let → T? Function<T>(dynamic input)
Alias for letOrNull.
final
letAs → T? Function<T>(dynamic input)
Alias for letAsOrNull.
final
letBool bool? Function(dynamic input)
Alias for letBoolOrNull.
final
letDateTime DateTime? Function(dynamic input)
Alias for letDateTimeOrNull.
final
letDouble double? Function(dynamic input)
Alias for letDoubleOrNull.
final
letDuration Duration? Function(dynamic input)
Alias for letDurationOrNull.
final
letInt int? Function(dynamic input)
Alias for letIntOrNull.
final
letIterable Iterable<T>? Function<T>(dynamic input, {bool filterNulls = false, dynamic nullFallback})
Alias for letIterableOrNull.
final
letList List<T>? Function<T>(dynamic input, {bool filterNulls = false, T? nullFallback})
Alias for letListOrNull.
final
letMap Map<K, V>? Function<K, V>(dynamic input, {bool filterNulls = false, dynamic nullFallback})
Alias for letMapOrNull.
final
letNum num? Function(dynamic input)
Alias for letNumOrNull.
final
letSet Set<T>? Function<T>(dynamic input, {bool filterNulls = false, T? nullFallback})
Alias for letSetOrNull.
final
letUri Uri? Function(dynamic input)
Alias for letUriOrNull.
final

Functions

castAsOrNull<T>(dynamic input) → T?
Similar to letAsOrNull, but uses a try-catch block internally.
combinedOrderedStringId(List<String> ids) String
Generates an ordered ID from a list of unordered IDs, that can be used to identify the list of IDs.
convertToStringCaseType(String value, StringCaseType? stringCaseType) String
Converts a string to a specific case type.
csvToMap(String input) Map<int, List<String>>
Converts a CSV string to a map.
expandFlattenedJson(Map input, {String separator = '.'}) Map
Expands a flattened JSON map, e.g. {'a.b': 1} to {a.b: 1, b: 1}.
expandJson(Map input, {String separator = '.'}) Map
Expands a Json map, e.g. {'a': {'b': 1}} to {a.b: 1, b: 1}.
flattenJson(Map input, {String separator = '.'}) Map
Flattens a nested JSON object into a single-level map with string keys.
getSetDifference<T>(Set<T> before, Set<T> after) Set<T>
Returns the difference between two sets.
isEquatable<T>() bool
Checks if T is any of the following types, which are directly comparable using the == operator and are passed by value:
isNullable<T>() bool
Returns true if T is nullable.
jsonDecode(String source, {Object? reviver(Object? key, Object? value)?}) → dynamic
Parses the string and returns the resulting Json object.
jsonEncode(Object? object, {Object? toEncodable(Object? nonEncodable)?}) String
Converts object to a JSON string.
letAsOrNull<T>(dynamic input) → T?
Let's you cast input to a T type if possible, or returns null if the cast cannot be performed.
letBoolOrNull(dynamic input) bool?
Let's you convert input to a bool type if possible, or returns null if the conversion cannot be performed.
letDateTimeOrNull(dynamic input) DateTime?
Let's you convert input to a DateTime type if possible, or returns null if the conversion cannot be performed.
letDoubleOrNull(dynamic input) double?
Let's you convert input to a double type if possible, or returns null if the conversion cannot be performed.
letDurationOrNull(dynamic input) Duration?
Let's you convert input to a Duration type if possible, or returns null if the conversion cannot be performed.
letIntOrNull(dynamic input) int?
Let's you convert input to an int type if possible, or returns null if the conversion cannot be performed.
letIterableFromCsv(String input) Iterable<String>
Let's you convert input to an Iterable of Strings if possible, or returns null if the conversion cannot be performed.
letIterableOrNull<T>(dynamic input, {bool filterNulls = false, dynamic nullFallback}) Iterable<T>?
Let's you convert input to an Iterable type if possible, or returns null if the conversion cannot be performed.
letListOrNull<T>(dynamic input, {bool filterNulls = false, T? nullFallback}) List<T>?
Let's you convert input to a List type if possible, or returns null if the conversion cannot be performed.
letMapOrNull<K, V>(dynamic input, {bool filterNulls = false, dynamic nullFallback}) Map<K, V>?
Let's you convert input to a Map type if possible, or returns null if the conversion cannot be performed.
letNumOrNull(dynamic input) num?
Let's you convert input to a num type if possible, or returns null if the conversion cannot be performed.
letOrNull<T>(dynamic input) → T?
Let's you convert input to a T type if possible, or returns null if the conversion cannot be performed.
letSetOrNull<T>(dynamic input, {bool filterNulls = false, T? nullFallback}) Set<T>?
Let's you convert input to a Set type if possible, or returns null if the conversion cannot be performed.
letUriOrNull(dynamic input) Uri?
Let's you convert input to a Uri type if possible, or returns null if the conversion cannot be performed.
mapToCsv(Map input) String
Converts a map to a CSV string.
mapToJson<T1, T2>(Map<T1, T2> input, {Set<Type> typesAllowed = const {}, String? keyConverter(dynamic)?}) Map<String, dynamic>
Converts a map to a Json map by recursively converting its keys and values to Json compatible types.
maybeAddToIterable<T>(Iterable<T>? source, Iterable<T>? add) Iterable<T>?
Adds add to source if both are not null.
maybeAddToList<T>(List<T>? source, List<T>? add) List<T>?
Adds add to source if both are not null.
maybeAddToMap<T1, T2>(Map<T1, T2>? source, Map<T1, T2>? add) Map<T1, T2>?
Adds add to source if both are not null.
maybeAddToSet<T>(Set<T>? source, Set<T>? add) Set<T>?
Adds add to source if both are not null.
mergeDataDeep(dynamic a, dynamic b, [dynamic elseFilter(dynamic)?]) → dynamic
Merges two data structures deeply.
mergeDataDeepIncludeCallsToJson(dynamic a, dynamic b) → dynamic
Merges two data structures deeply and tries to perform toJson on objects.
mergeDataDeepIncludeCallsToMap(dynamic a, dynamic b) → dynamic
Merges two data structures deeply and tries to perform toMap on objects.
mergeIterables(dynamic a, dynamic b) Iterable
Merges two iterables into one iterable.
mergeListsSetsOrQueues(Iterable a, Iterable b) Iterable
Merges two Iterables into one. Supported Iterable types are List, Set, and Queue.
mergeMapsDeep<K, V>(List<Map<K, V>> maps) Map<K, V>
Merges all maps deeply.
nullFilteredList<T>(Iterable input) List<T>
Converts input to a List with non-null elements if T is non-null.
nullFilteredMap<K, V>(Map input) Map<K, V>
Converts input to a Map with non-null keys and values if K and V are non-null.
nullFilteredSet<T>(Iterable input) Set<T>
Converts input to a Set with non-null elements if T is non-null.
nullIfEmpty<T>(T value) → T?
Returns null if value is empty, otherwise returns value.
traverseMap(Map map, Iterable keys, {dynamic newValue}) → dynamic
Traverses a Map using a list of keys. If the keys do not exist, they are created. If newValue is provided, the value at the end of the traversal is set to newValue.
trimmedOrNull(Object? input) String?
Converts the input to a string if it's not null and trims it or returns null if the result is empty.
tryToJson(dynamic object) → dynamic
Tries to convert an object to a json map by calling its toJson method if it exists.
tryToMap(dynamic object) → dynamic
Tries to convert an object to a map by calling its toMap method if it exists.
typeEquality<T1, T2>() bool
Returns true if T1 and T2 are the same type.
uniqueEntries<K, V>(Iterable<MapEntry<K, V>> entries) List<MapEntry<K, V>>
uniqueKeys<K, V>(Iterable<MapEntry<K, V>> entries) List<MapEntry<K, V>>
uniqueValues<K, V>(Iterable<MapEntry<K, V>> entries) List<MapEntry<K, V>>

Typedefs

DataRef = DataRefModel
Field = FieldModel
TFieldRecord = ({List<String>? fieldPath, String? fieldType, bool? nullable})
A record representing a field. Similar to FieldModel.

Exceptions / Errors

ConvertStringToDurationEx
Exception thrown by ConvertStringToDuration when a problem occurs.