Commit 4350be7 Tony Sansone
committed
1 parent e28753e commit 4350be7 Copy full SHA for 4350be7
File tree 4 files changed +16
-8
lines changed
examples/misc/lib/language_tour/classes
4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,6 @@ class PointB {
62
62
// Initializing formal parameters can also be optional.
63
63
PointB .optional ([this .x = 0.0 , this .y = 0.0 ]);
64
64
PointB .named ({required this .x, required this .y});
65
-
66
- // Private fields cannot be used as named initializing formals.
67
- PointB .namedPrivate ({required double x, required double y})
68
- : _x = x,
69
- _y = y;
70
65
}
71
66
// #enddocregion initialize-formal
72
67
Original file line number Diff line number Diff line change @@ -560,7 +560,7 @@ we made the following changes to this site:
560
560
[ Low-level HTML tutorials ] : /web/get-started
561
561
562
562
[ native types ] : /interop/c-interop#interfacing-with-native-types
563
- [ initializing formal parameters ] : /language/constructors#initializing-formal-parameters
563
+ [ initializing formal parameters ] : /language/constructors#use- initializing-formal-parameters
564
564
[ support for packages ] : /tools/dartpad#library-support
565
565
[ asynchronous programming codelab ] : /codelabs/async-await
566
566
[ why asynchronous code matters ] : /codelabs/async-await#why-asynchronous-code-matters
Original file line number Diff line number Diff line change @@ -369,7 +369,7 @@ can pass a static method as a parameter to a constant constructor.
369
369
[ `Type` ] : {{site.dart-api}}/{{site.sdkInfo.channel}}/dart-core/Type-class.html
370
370
[ type test operator ] : /language/operators#type-test-operators
371
371
[ Getters and setters ] : /language/methods#getters-and-setters
372
- [ initializer list ] : /language/constructors#initializer-list
372
+ [ initializer list ] : /language/constructors#use-an- initializer-list
373
373
[ factory constructor ] : /language/constructors#factory-constructors
374
374
[ late-final-ivar ] : /effective-dart/design#avoid-public-late-final-fields-without-initializers
375
375
[ nullable type ] : /null-safety/understanding-null-safety#using-nullable-types
Original file line number Diff line number Diff line change @@ -420,11 +420,24 @@ class PointB {
420
420
// Initializing formal parameters can also be optional.
421
421
PointB.optional([this.x = 0.0, this.y = 0.0]);
422
422
PointB.named({required this.x, required this.y});
423
+ }
424
+ ```
425
+
426
+ Private fields can't be used as named initializing formals.
427
+
428
+ {% comment %}
429
+ Don't attach the following example to a code excerpt.
430
+ It doesn't work on purpose and will cause errors in CI.
431
+ {% endcomment %}
432
+ ``` dart
433
+ class PointB {
434
+ // ...
423
435
424
- // Private fields cannot be used as named initializing formals.
425
436
PointB.namedPrivate({required double x, required double y})
426
437
: _x = x,
427
438
_y = y;
439
+
440
+ // ...
428
441
}
429
442
```
430
443
You can’t perform that action at this time.
0 commit comments