We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The abstract Point class following factory methods to create new point instances of the same sub type methods are called on.
Point
Point newWith({num x = 0.0, num y = 0.0, num? z, num? m}); Point newFrom(Iterable<num> coords, {int? offset, int? length});
Sub classes like Point2 implement these methods like:
Point2
@override Point newWith({num x = 0.0, num y = 0.0, num? z, num? m}) => Point2(x: x, y: y); @override Point newFrom(Iterable<num> coords, {int? offset, int? length}) { CoordinateFactory.checkCoords(2, coords, offset: offset, length: length); return Point2.from(coords, offset: offset); }
This should work fine.
However if you are using a specific Point sub type, like Point2, then it might be useful to define more specific return type.
That is, for Point2 the implementation would change to following:
@override Point2 newWith({num x = 0.0, num y = 0.0, num? z, num? m}) => Point2(x: x, y: y); @override Point2 newFrom(Iterable<num> coords, {int? offset, int? length}) { CoordinateFactory.checkCoords(2, coords, offset: offset, length: length); return Point2.from(coords, offset: offset); }
The text was updated successfully, but these errors were encountered:
Implemented on the pre-release 0.8.0-a.2 of the upcoming 0.8.0 release
Sorry, something went wrong.
No branches or pull requests
The abstract
Point
class following factory methods to create new point instances of the same sub type methods are called on.Sub classes like
Point2
implement these methods like:This should work fine.
However if you are using a specific
Point
sub type, likePoint2
, then it might be useful to define more specific return type.That is, for
Point2
the implementation would change to following:The text was updated successfully, but these errors were encountered: