add method

  1. @Possible({RangeError})
  2. @useResult
Offset add(
  1. Duration duration
)

Returns a copy of this with the duration added.

Contract

Throws a RangeError if the result is outside the valid range.

Example

Offset(16).add(Duration(hours: 2)); // Offset(18)

Offset(18).add(Duration(hours: 2)); // throws RangeError

Implementation

@Possible({RangeError})
@useResult Offset add(Duration duration) => Offset.fromMicroseconds(_microseconds + duration.inSeconds * 1000 * 1000);