Friction extension type
The Friction
extension type represents a friction coefficient, indicating how much resistance
a material or surface provides against motion. The values range from very slippery (like ice)
to extremely grippy (like duct tape).
This extension type implements the double
interface, making it usable wherever a double
is expected.
It provides several predefined friction values, from the near-frictionless ice to the super sticky duct tape.
You can also create custom friction values using the Friction.custom()
factory constructor.
- on
- Implemented types
- Available extensions
Constructors
- Friction(double value)
-
const
- Friction.custom(double value)
-
Creates a custom
Friction
instance with the specifiedvalue
.factory
Properties
-
address
↔ Pointer<
Never> -
Available on double, provided by the DoubleAddress extension
The memory address of the underlying data.getter/setter pair - hashCode → int
-
Returns a hash code for a numerical value.
no setterinherited
- isFinite → bool
-
Whether this number is finite.
no setterinherited
- isInfinite → bool
-
Whether this number is positive infinity or negative infinity.
no setterinherited
- isNaN → bool
-
Whether this number is a Not-a-Number value.
no setterinherited
- isNegative → bool
-
Whether this number is negative.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sign → double
-
The sign of the double's numerical value.
no setterinherited
- toJS → JSNumber
-
Available on double, provided by the DoubleToJSNumber extension
Converts this double to a JSNumber.no setter - toJS → JSNumber
-
Available on num, provided by the NumToJSExtension extension
Converts this num to a JSNumber.no setter - value → double
-
final
Methods
-
abs(
) → double -
The absolute value of this number.
inherited
-
ceil(
) → int -
Returns the least integer that is not smaller than this number.
inherited
-
ceilToDouble(
) → double -
Returns the least integer double value no smaller than
this
.inherited -
clamp(
num lowerLimit, num upperLimit) → num -
Returns this num clamped to be in the range
lowerLimit
-upperLimit
.inherited -
compareTo(
num other) → int -
Compares this to
other
.inherited -
floor(
) → int -
Returns the greatest integer no greater than this number.
inherited
-
floorToDouble(
) → double -
Returns the greatest integer double value no greater than
this
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remainder(
num other) → double -
The remainder of the truncating division of
this
byother
.inherited -
round(
) → int -
Returns the integer closest to this number.
inherited
-
roundToDouble(
) → double -
Returns the integer double value closest to
this
.inherited -
toDouble(
) → double -
This number as a double.
inherited
-
toInt(
) → int -
Truncates this num to an integer and returns the result as an int.
inherited
-
toString(
) → String -
Provide a representation of this double value.
inherited
-
toStringAsExponential(
[int? fractionDigits]) → String -
An exponential string-representation of this number.
inherited
-
toStringAsFixed(
int fractionDigits) → String -
A decimal-point string-representation of this number.
inherited
-
toStringAsPrecision(
int precision) → String -
A string representation with
precision
significant digits.inherited -
truncate(
) → int -
Returns the integer obtained by discarding any fractional
part of this number.
inherited
-
truncateToDouble(
) → double -
Returns the integer double value obtained by discarding any fractional
digits from
this
.inherited
Operators
-
operator %(
num other) → double -
Euclidean modulo of this number by
other
.inherited -
operator *(
num other) → double -
Multiplies this number by
other
.inherited -
operator +(
num other) → double -
Adds
other
to this number.inherited -
operator -(
num other) → double -
Subtracts
other
from this number.inherited -
operator /(
num other) → double -
Divides this number by
other
.inherited -
operator <(
num other) → bool -
Whether this number is numerically smaller than
other
.inherited -
operator <=(
num other) → bool -
Whether this number is numerically smaller than or equal to
other
.inherited -
operator ==(
Object other) → bool -
Test whether this value is numerically equal to
other
.inherited -
operator >(
num other) → bool -
Whether this number is numerically greater than
other
.inherited -
operator >=(
num other) → bool -
Whether this number is numerically greater than or equal to
other
.inherited -
operator unary-(
) → double -
The negation of this value.
inherited
-
operator ~/(
num other) → int -
Truncating division operator.
inherited
Constants
- bananaPeel → const Friction
-
Represents the notoriously slippery banana peel, with a friction coefficient of
0.03
. - coarseAdjustment → const double
-
A coarse adjustment level for friction, representing an increment of
0.5
. - ductTape → const Friction
- Duct tape: the universal solution to everything. When in doubt, just tape it.
- fineAdjustment → const double
-
A fine adjustment level for friction, representing an increment of
0.0001
. - ice → const Friction
-
Represents the near-frictionless surface of ice, with a friction coefficient of
0.01
. - leather → const Friction
-
Represents the friction of leather, with a friction coefficient of
0.5
. - majorAdjustment → const double
-
A major adjustment level for friction, representing an increment of
0.1
. - minorAdjustment → const double
-
A minor adjustment level for friction, representing an increment of
0.001
. - moderateAdjustment → const double
-
A moderate adjustment level for friction, representing an increment of
0.01
. - oil → const Friction
-
Represents the friction of oil, with a friction coefficient of
0.1
. - polishedWood → const Friction
-
Represents the friction of polished wood, with a friction coefficient of
0.3
. - rubber → const Friction
-
Represents the friction of rubber, with a friction coefficient of
0.8
. - sandpaper → const Friction
-
Represents the friction of sandpaper, with a friction coefficient of
1.5
. - steelOnSteel → const Friction
-
Represents the friction of steel on steel, with a friction coefficient of
0.6
. - teflon → const Friction
-
Represents the friction of Teflon, with a friction coefficient of
0.04
.