IntExtensions extension

Extension methods for int type.

on

Methods

add(int value) int

Available on int, provided by the IntExtensions extension

Adds a value to this integer.
addGST(double percent) double

Available on int, provided by the IntExtensions extension

Adds GST to this number.
applyPercent(double percent) double

Available on int, provided by the IntExtensions extension

Applies a percentage to this number (adds percentage).
ceilTo(int decimals) int

Available on int, provided by the IntExtensions extension

Ceils this integer to the nearest value.
clamped({required int min, required int max}) int

Available on int, provided by the IntExtensions extension

Clamps this integer between min and max.
discount(double percent) double

Available on int, provided by the IntExtensions extension

Applies a discount percentage to this number (subtracts percentage).
div(int value) double

Available on int, provided by the IntExtensions extension

Divides this integer by a value. Returns a double since division may result in a fractional value.
floorTo(int decimals) int

Available on int, provided by the IntExtensions extension

Floors this integer to the nearest value.
isBetween(int min, int max) bool

Available on int, provided by the IntExtensions extension

Checks if this integer is between min and max (inclusive).
lerp(int end, double t) double

Available on int, provided by the IntExtensions extension

Linear interpolation between this value and end at t.
mapRange({required int fromMin, required int fromMax, required double toMin, required double toMax}) double

Available on int, provided by the IntExtensions extension

Maps this value from one range fromMin, fromMax to another toMin, toMax.
mul(int value) int

Available on int, provided by the IntExtensions extension

Multiplies this integer by a value.
percent({required int of}) double

Available on int, provided by the IntExtensions extension

Calculates what percentage this number is of another number.
removeGST(double percent) double

Available on int, provided by the IntExtensions extension

Removes GST from this number.
roundTo(int decimals) int

Available on int, provided by the IntExtensions extension

Rounds this integer to the nearest value.
sub(int value) int

Available on int, provided by the IntExtensions extension

Subtracts a value from this integer.
tax(double percent) double

Available on int, provided by the IntExtensions extension

Applies a tax percentage to this number (adds percentage).
toCurrency({String symbol = '\$', int decimals = 2}) String

Available on int, provided by the IntExtensions extension

Formats this integer as currency.
toCurrencyType(dynamic currency) String

Available on int, provided by the IntExtensions extension

Formats this integer using a specific currency.
toINR() String

Available on int, provided by the IntExtensions extension

Formats this integer as Indian Rupee (INR).
toOrdinal() String

Available on int, provided by the IntExtensions extension

Converts this integer to an ordinal string (1st, 2nd, 3rd, etc.).
toReadable() String

Available on int, provided by the IntExtensions extension

Formats this integer as a readable number with K, M, B, T suffixes. Automatically chooses the appropriate suffix based on value.