Skip to content

Commit

Permalink
Update generative constructor example to not override default value (#…
Browse files Browse the repository at this point in the history
…6206)

Update documentation for generative constructor by dropping the value assigned in the field definitions.

This allows the example to focus on generative constructors, as the section is titled.

---------

Co-authored-by: Marya <[email protected]>
Co-authored-by: Parker Lougheed <[email protected]>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent d771328 commit 771459b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/misc/lib/language_tour/classes/point_alt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
///
// #docregion idiomatic-constructor
class Point {
// Initializer list of variables and values
double x = 2.0;
double y = 2.0;
// Instance variables to hold the coordinates of the point.
double x;
double y;

// Generative constructor with initializing formal parameters:
Point(this.x, this.y);
Expand Down
6 changes: 3 additions & 3 deletions src/content/language/constructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ To instantiate a class, use a generative constructor.
<?code-excerpt "point_alt.dart (idiomatic-constructor)" plaster="none"?>
```dart
class Point {
// Initializer list of variables and values
double x = 2.0;
double y = 2.0;
// Instance variables to hold the coordinates of the point.
double x;
double y;
// Generative constructor with initializing formal parameters:
Point(this.x, this.y);
Expand Down

0 comments on commit 771459b

Please sign in to comment.