# DpSquared

@Immutable inline class DpSquared : Comparable<DpSquared>

kotlin.Any | |

↳ | androidx.ui.unit.DpSquared |

Holds a unit of squared dimensions, such as `1.value * 2.dp`

. DpSquared, DpCubed,
and DpInverse are used primarily for Dp calculations to ensure resulting
units are as expected. Many times, Dp calculations use scalars to determine the final
dimension during calculation:
val width = oldWidth * stretchAmount
Other times, it is useful to do intermediate calculations with Dimensions directly:
val width = oldWidth * newTotalWidth / oldTotalWidth

## Summary

Public constructors | |
---|---|

Holds a unit of squared dimensions, such as |

Public methods | |
---|---|

operator Int |
Support comparing DpSquared with comparison operators. |

operator DpSquared |
Divide a DimensionSquare by a scalar. |

operator Dp | |

operator Float |
Divide by a DpSquared to get a scalar result. |

operator DpInverse | |

operator DpSquared |
Subtract a DimensionSquare from another one. |

operator DpSquared |
Add two DimensionSquares together. |

operator DpSquared |
Multiply by a scalar to get a DpSquared result. |

operator DpCubed |
Multiply by a scalar to get a DpSquared result. |

String |
`toString()` |

Properties | |
---|---|

Float |

## Public constructors

### <init>

DpSquared(value: Float)

Holds a unit of squared dimensions, such as `1.value * 2.dp`

. DpSquared, DpCubed,
and DpInverse are used primarily for Dp calculations to ensure resulting
units are as expected. Many times, Dp calculations use scalars to determine the final
dimension during calculation:
val width = oldWidth * stretchAmount
Other times, it is useful to do intermediate calculations with Dimensions directly:
val width = oldWidth * newTotalWidth / oldTotalWidth

## Public methods

### compareTo

@Stable operator fun compareTo(other: DpSquared): Int

Support comparing DpSquared with comparison operators.

### div

@Stable inline operator fun div(other: DpSquared): Float

Divide by a DpSquared to get a scalar result.

### minus

@Stable inline operator fun minus(other: DpSquared): DpSquared

Subtract a DimensionSquare from another one.

### plus

@Stable inline operator fun plus(other: DpSquared): DpSquared

Add two DimensionSquares together.

### times

@Stable inline operator fun times(other: Float): DpSquared

Multiply by a scalar to get a DpSquared result.

### times

@Stable inline operator fun times(other: Dp): DpCubed

Multiply by a scalar to get a DpSquared result.

### toString

@Stable fun toString(): String

## Properties

### value

val value: Float