modules/utils/utils/utils
library
Functions
-
convertToTitleCase(String text)
→ String
-
Returns a title case form string
-
doubleStringWithoutTrailingZeros(String? doubleString)
→ String
-
Given a number string this will display decimals just if it contains them
For example
0.012 => 0.012
3.2 => 3.2
2.0 => 2
-
formattedPrice(double? price, [String? symbol])
→ String
-
Returns a string representing a formatted price with currency
A custom
symbol
can be provided to be used instead
-
isStrNil(String? string)
→ bool
-
Check if given string is empty or null
-
mapToPairedList(Map map)
→ List
-
Given a map this will transform ir into an array of sequential paired items
ie:
{"key1": "value1", "key2": "value2"} ->
"key1", "value1", "key2", "value2"
-
modifyPairedListAsMap(List list, Map transformer(Map))
→ List
-
This function let you modify an array of sequential paired items as a map and return it in the array form
Check pairedListToMap for more details
-
numberToRoundedValue(dynamic number, {String orElse(dynamic)?})
→ String
-
Given an object this function will try to parse as double and round the value
returning a string
It also provides a fallback function
orElse
to use if the value processed is an invalid number
by default this returns 0
if no fallback provided
-
pairedListToMap(List list)
→ Map<String, dynamic>
-
Given an array of sequential paired items this will transform ir into a map
ie:
"key1", "value1", "key2", "value2"
-> {"key1": "value1", "key2": "value2"}