-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.linter-new-language-featuretype-documentationA request to add or improve documentationA request to add or improve documentation
Description
Current doc (here)
PREFER defining constructors instead of static methods to create instances.
In most cases, it makes more sense to use a named constructor rather than a
static method because it makes instantiation clearer.
BAD:
class Point {
num x, y;
Point(this.x, this.y);
static Point polar(num theta, num radius) {
return Point(radius * math.cos(theta),
radius * math.sin(theta));
}
}GOOD:
class Point {
num x, y;
Point(this.x, this.y);
Point.polar(num theta, num radius)
: x = radius * math.cos(theta),
y = radius * math.sin(theta);
}@srawlins: can you elaborate on what you had in mind for updating the docs?
Metadata
Metadata
Assignees
Labels
devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.linter-new-language-featuretype-documentationA request to add or improve documentationA request to add or improve documentation