MultipleOf<T extends num> class

Validates that a value is a multiple of the specified divisor.

Uses a floating-point-safe algorithm: divides input by divisor and checks whether the quotient is within _epsilon of a whole number. The naive input % divisor == 0 check fails for decimal divisors such as 0.1 due to IEEE-754 rounding (e.g. 0.3 % 0.1 is not exactly 0).

Implemented types

Constructors

MultipleOf(T divisor)

Properties

divisor → T
final
hashCode int
The hash code for this object.
no setteroverride
name String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(num input) bool
override
multipleOf(num input, num divisor) bool
Returns true if input is a multiple of divisor.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override