sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Deprecate `Point`, `Rectangle`, and `MutableRectangle` in `dart:math`

Open parlough opened this issue 1 year ago • 0 comments

Now that dart:html usage has been decreasing and is going to continue to. They were moved from dart:html as part of https://github.com/dart-lang/sdk/issues/9213, but that continued to be their primary use.

A Point on a screen does not really belong in a math library, nor does Rectangle. Beyond that, Point declares operators that don't make sense for a point, conflating it with a vector. The * operator on Point<int> can also result in a runtime error when provided with a double 😢.

Some related discussion about performance concerns: https://github.com/dart-lang/sdk/issues/53912


All this isn't to say the functionality they provide isn't useful, but the use cases can now be better supported by focused packages that are easier to evolve. A lot of the previous uses are likely covered by a simple record too.

parlough avatar Feb 07 '24 22:02 parlough