Rect<T extends num> constructor

Rect<T extends num>([
  1. T? left,
  2. T? top,
  3. T? width,
  4. T? height,
])

Creates a new Rect.

If left, top, width, or height are not provided, they default to 0 of type T.

Implementation

factory Rect([T? left, T? top, T? width, T? height]) {
  var zero = 0 as T;
  return Rect<T>._(left ?? zero, top ?? zero, width ?? zero, height ?? zero);
}