Extension types don't seem to support typed data, for instance Float64x2.
There is a restriction that typed_data isn't extended, but that applies to other types like int, double, which extension types can use.
import 'dart:math';
import 'dart:typed_data';
extension type const Point._(Float64x2 point) implements Float64x2 {
Point(double x, double y) : point = Float64x2(x, y);
double get distance => sqrt(point.x * point.x + point.y * point.y);
}
void main() => print(Point(0, 0)); // prints null
I was checking to see if extension types would be more performant in the case of Offset, but using List<double> is actually slower from my tests.
Extension types don't seem to support typed data, for instance
Float64x2.There is a restriction that typed_data isn't extended, but that applies to other types like
int,double, which extension types can use.I was checking to see if extension types would be more performant in the case of
Offset, but usingList<double>is actually slower from my tests.