Skip to content

Commit c5c484d

Browse files
authored
Follow up on null safety codelab (#3112)
* Add null safety codelab to the codelab index * Listof -> ListOf * Add link to issue #3093 * Retire the tour in favor of the codelab
1 parent 7e60313 commit c5c484d

File tree

6 files changed

+23
-288
lines changed

6 files changed

+23
-288
lines changed

firebase.json

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
{ "source": "/linter/lints/:lint*", "destination": "https://dart-lang.github.io/linter/lints/:lints*", "type": 301 },
155155
{ "source": "/mailing-list", "destination": "https://groups.google.com/a/dartlang.org/forum/#!forum/misc", "type": 301 },
156156
{ "source": "/news{,/**}", "destination": "https://news.dartlang.org/", "type": 301 },
157+
{ "source": "/null-safety/tour", "destination": "/codelabs/null-safety", "type": 301 },
157158
{ "source": "/observatory{,/**}", "destination": "https://dart-lang.github.io/observatory", "type": 301 },
158159
{ "source": "/posters{,/**}", "destination": "https://github.com/dart-lang/www.dartlang.org/tree/f5f235e56e51d38d9f4d01f949d0a485f3828056/src/site/posters", "type": 301 },
159160
{ "source": "/pub/tools/editor", "destination": "/tools", "type": 301 },
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
void main() {
2-
List<String> aListofStrings = ['one', 'two', 'three'];
2+
List<String> aListOfStrings = ['one', 'two', 'three'];
33
List<String?> aNullableListOfStrings = [];
4-
List<String?> aListofNullableStrings = ['one', null, 'three'];
4+
List<String?> aListOfNullableStrings = ['one', null, 'three'];
55

6-
print('aListofStrings is $aListofStrings.');
6+
print('aListOfStrings is $aListOfStrings.');
77
print('aNullableListOfStrings is $aNullableListOfStrings.');
8-
print('aListofNullableStrings is $aListofNullableStrings.');
8+
print('aListOfNullableStrings is $aListOfNullableStrings.');
99
}

src/codelabs/index.md

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ with special attention to filtering and mapping values.
3131
Use DartPad to learn or remind yourself of how to write
3232
asynchronous code using futures and the `async` and `await` keywords.
3333

34+
### [Null safety](/codelabs/null-safety)
35+
36+
Use DartPad to learn about Dart's null-safe type system,
37+
which was introduced in Dart 2.12.
38+
3439
## Flutter
3540

3641
To learn about Flutter, try one of the

src/codelabs/null-safety.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ question marks to correct the type declarations of `aNullableListOfStrings` and
7777
<?code-excerpt "../null_safety_examples/null_safety_codelab/bin/more_nullable_types.dart" replace="/String\?/String/g"?>
7878
```dart:run-dartpad:ga_id-nullable_type_generics:null_safety-true
7979
void main() {
80-
List<String> aListofStrings = ['one', 'two', 'three'];
80+
List<String> aListOfStrings = ['one', 'two', 'three'];
8181
List<String> aNullableListOfStrings = [];
82-
List<String> aListofNullableStrings = ['one', null, 'three'];
82+
List<String> aListOfNullableStrings = ['one', null, 'three'];
8383
84-
print('aListofStrings is $aListofStrings.');
84+
print('aListOfStrings is $aListOfStrings.');
8585
print('aNullableListOfStrings is $aNullableListOfStrings.');
86-
print('aListofNullableStrings is $aListofNullableStrings.');
86+
print('aListOfNullableStrings is $aListOfNullableStrings.');
8787
}
8888
```
8989

@@ -322,3 +322,7 @@ are some suggestions for where to go next:
322322

323323
If you're interested in using embedded DartPads, like this codelab does, see
324324
[best practices for using DartPad in tutorials](/resources/dartpad-best-practices).
325+
If you're interested in improving this codelab, see
326+
[issue #3093][].
327+
328+
[issue #3093]: https://github.com/dart-lang/site-www/issues/3093

src/null-safety/index.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ or learn about null safety using
3838

3939
![Screenshot of DartPad in null-safe mode](/null-safety/dartpad-snippet.png)
4040

41-
For an example-driven summary of null safety language features,
42-
see the [null safety feature tour](/null-safety/tour).
43-
For a more in-depth discussion, see
41+
For an interactive, example-driven introduction to null safety language features,
42+
see the [null safety codelab][Null safety codelab].
43+
For an in-depth discussion, see
4444
[Understanding null safety](/null-safety/understanding-null-safety).
4545

4646

@@ -131,7 +131,7 @@ The Dart team is currently aware of the following issues:
131131

132132
For more information about null safety, see the following resources:
133133

134-
* [Null safety tour][]
134+
* [Null safety codelab][]
135135
* [Understanding null safety][]
136136
* [Migration guide for existing code][migration guide]
137137
* [Null safety FAQ][]
@@ -146,7 +146,7 @@ For more information about null safety, see the following resources:
146146
[Dart blog]: https://medium.com/dartlang
147147
[migration guide]: /null-safety/migration-guide
148148
[Null safety FAQ]: /null-safety/faq
149-
[Null safety tour]: /null-safety/tour
149+
[Null safety codelab]: /codelabs/null-safety
150150
[nullsafety.dartpad.dev]: https://nullsafety.dartpad.dev
151151
[Understanding null safety]: /null-safety/understanding-null-safety
152152

src/null-safety/tour.md

-275
This file was deleted.

0 commit comments

Comments
 (0)