NumberUtils class
Number utility functions for common number operations
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
calculateCompoundInterest(
double principal, double rate, double time, {int compoundingFrequency = 12}) → double - Calculate compound interest
-
calculatePercentage(
double value, double total) → double - Calculate percentage
-
calculateSimpleInterest(
double principal, double rate, double time) → double - Calculate simple interest
-
convertLength(
double value, String fromUnit, String toUnit) → double - Convert length units
-
convertTemperature(
double temperature, String fromUnit, String toUnit) → double - Convert temperature between Celsius and Fahrenheit
-
convertWeight(
double value, String fromUnit, String toUnit) → double - Convert weight units
-
factorial(
int number) → int - Get factorial of a number
-
formatWithCommas(
int number) → String - Format number with commas
-
formatWithCommasDouble(
double number, {int decimalPlaces = 2}) → String - Format number with commas (double)
-
gcd(
int a, int b) → int - Get greatest common divisor
-
isEven(
int number) → bool - Check if number is even
-
isOdd(
int number) → bool - Check if number is odd
-
isPrime(
int number) → bool - Check if number is prime
-
lcm(
int a, int b) → int - Get least common multiple
-
numberToWords(
int number) → String - Convert number to words (Indian format)
-
randomDouble(
double min, double max) → double - Generate random double within range
-
randomInt(
int min, int max) → int - Generate random number within range
-
roundToDecimalPlaces(
double number, int decimalPlaces) → double - Round number to specified decimal places
-
toOrdinal(
int number) → String - Convert number to ordinal