Skip to content

Commit f13852c

Browse files
committed
fix dotshorthand code comments
1 parent 54f4900 commit f13852c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

examples/language/lib/classes/shorthand.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ List<int> intList = .filled(5, 0); // Instead of List.filled(5, 0)
7171
// #docregion chain
7272
// .fromCharCode(72) resolves to the String "H",
7373
// then the instance method .toLowerCase() is called on that String.
74-
String lowerH = .fromCharCode(72).toLowerCase(); // Instead of String.fromCharCode(72).toLowerCase()
74+
String lowerH = .fromCharCode(72).toLowerCase();
75+
// Instead of String.fromCharCode(72).toLowerCase()
7576

7677
print(lowerH); // Output: h
7778
// #enddocregion chain
@@ -139,8 +140,7 @@ class Point {
139140
const Status defaultStatus = .running; // Instead of Status.running
140141

141142
// Invoking a const named constructor
142-
const Point myOrigin = .origin();
143-
// Instead of Point.origin()
143+
const Point myOrigin = .origin(); // Instead of Point.origin()
144144

145145
// Using shorthands in a const collection literal
146146
const List<Point> keyPoints = [ .origin(), .new(1.0, 1.0) ];

src/content/language/dot-shorthand.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,14 @@ class Point {
164164
}
165165
166166
// Enum values are always constants
167-
const Status defaultStatus = .running; // Instead of const Status.running
167+
const Status defaultStatus = .running; // Instead of Status.running
168168
169169
// Invoking a const named constructor
170-
const Point myOrigin = .origin(); // Instead of const Point.origin()
170+
const Point myOrigin = .origin(); // Instead of Point.origin()
171171
172172
// Using shorthands in a const collection literal
173-
const List<Point> keyPoints = [ .origin(), .new(1.0, 1.0) ]; // Instead of [const Point.origin(), const Point(1.0, 1.0)]
173+
const List<Point> keyPoints = [ .origin(), .new(1.0, 1.0) ];
174+
// Instead of [Point.origin(), Point(1.0, 1.0)]
174175
```
175176

176177

@@ -191,7 +192,8 @@ context type.
191192
```dart
192193
// .fromCharCode(72) resolves to the String "H",
193194
// then the instance method .toLowerCase() is called on that String.
194-
String lowerH = .fromCharCode(72).toLowerCase(); // Instead of String.fromCharCode(72).toLowerCase()
195+
String lowerH = .fromCharCode(72).toLowerCase();
196+
// Instead of String.fromCharCode(72).toLowerCase()
195197
196198
print(lowerH); // Output: h
197199
```

0 commit comments

Comments
 (0)