diff --git a/examples/misc/analyzer-results-stable.txt b/examples/misc/analyzer-results-stable.txt index b564b55a2b..8db74b425c 100644 --- a/examples/misc/analyzer-results-stable.txt +++ b/examples/misc/analyzer-results-stable.txt @@ -1,7 +1,7 @@ Analyzing misc... - error - lib/language_tour/classes/point_this.dart:8:15 - Invalid reference to 'this' expression. - invalid_reference_to_this - info - lib/language_tour/classes/point_this.dart:8:15 - Unnecessary 'this.' qualifier. Try removing 'this.'. - unnecessary_this - info - lib/language_tour/classes/point_this.dart:9:20 - Unnecessary 'this.' qualifier. Try removing 'this.'. - unnecessary_this + error - lib/language_tour/classes/point_this.dart:7:15 - Invalid reference to 'this' expression. - invalid_reference_to_this + info - lib/language_tour/classes/point_this.dart:7:15 - Unnecessary 'this.' qualifier. Try removing 'this.'. - unnecessary_this + info - lib/language_tour/classes/point_this.dart:8:20 - Unnecessary 'this.' qualifier. Try removing 'this.'. - unnecessary_this 3 issues found. diff --git a/examples/misc/lib/language_tour/classes/point_this.dart b/examples/misc/lib/language_tour/classes/point_this.dart index bb62f3cd0b..d75028de1c 100644 --- a/examples/misc/lib/language_tour/classes/point_this.dart +++ b/examples/misc/lib/language_tour/classes/point_this.dart @@ -3,12 +3,10 @@ double initialX = 1.5; class Point { - double? x = - initialX; // OK, can access declarations that do not depend on `this`. + double? x = initialX; // OK, can access declarations that do not depend on `this`. double? y = this.x; // ERROR, can't access `this` in non-`late` initializer. late double? z = this.x; // OK, can access `this` in `late` initializer. - Point(this.x, - this.y); // OK, `this.fieldName` is a parameter declaration, not an expression. + Point(this.x, this.y); // OK, `this.fieldName` is a parameter declaration, not an expression. } // #enddocregion this-late diff --git a/src/language/classes.md b/src/language/classes.md index 23f16835dc..c117a0c80f 100644 --- a/src/language/classes.md +++ b/src/language/classes.md @@ -203,13 +203,11 @@ of a non-`late` instance variable can't access `this`. double initialX = 1.5; class Point { - double? x = - initialX; // OK, can access declarations that do not depend on `this`. + double? x = initialX; // OK, can access declarations that do not depend on `this`. double? y = this.x; // ERROR, can't access `this` in non-`late` initializer. late double? z = this.x; // OK, can access `this` in `late` initializer. - Point(this.x, - this.y); // OK, `this.fieldName` is a parameter declaration, not an expression. + Point(this.x, this.y); // OK, `this.fieldName` is a parameter declaration, not an expression. } ```