useful_utils library

Functions

capitalize(String value) String
Capitalize first letter
fixedDecimais({required dynamic value, required int decimalPlaces}) double
Fixed decimals and return the double value If the input value is a string or int, convert it to double before
isEven(dynamic value) bool
Check if number is even and return a bool
isOdd(dynamic value) bool
Check if number is odd and return a bool
lowerAndCapitalize(String value) String
lower entire word and capitalize first letter
lowerAndCapitalizeAllWords(String value) String
lower all text and capitalize all words
percentage({required dynamic value, required dynamic total, int? round}) double
Calculate the percentage of a number, and round the result if pass the optional parameter
percentageReverse({required dynamic percentage, required dynamic total, int? round}) double
Discovery value from percentage of a number, and round the result if pass the optional parameter
randomInt({required int min, required int max}) int
expect a min and max number and return a random number between them
remap(double value, double start1, double stop1, double start2, double stop2) double
This funcion is like a lerp and unlerp, but is general. Its expect a number and a range for interpolate, after the result is interpolated with a second range
toDouble(dynamic value) double
Convert a string or int to double and returns the double value Throws a Error if cant be converted
tryToDouble(dynamic value) double?
Convert a string or int to double and returns the double value Returns null if cant be converted