1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-08 12:06:26 +00:00

[collection] Update example code in dartdoc

Added 'final' to the example class `EntryItem` that extends
`LinkedListEntry` from 'dart:collection'.

The code as written now produces the error:

```
The type 'EntryItem' must be 'base', 'final' or 'sealed' because the
supertype 'LinkedListEntry' is 'base'.
```

Also applied dartfmt to get new line break locations.

Change-Id: I78e76c7d9d4e6cd29c2e229ab1054efad21c6248
CoreLibraryReviewExempt: Comments only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343688
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Nicholas Shahan 2023-12-28 23:37:27 +00:00 committed by Commit Queue
parent c944fc1db1
commit 0c4147675f

View File

@ -31,7 +31,7 @@ part of dart.collection;
///
/// Example:
/// ```dart
/// class EntryItem extends LinkedListEntry<EntryItem> {
/// final class EntryItem extends LinkedListEntry<EntryItem> {
/// final int id;
/// final String text;
/// EntryItem(this.id, this.text);
@ -42,10 +42,10 @@ part of dart.collection;
/// }
/// }
///
/// void main(){
/// void main() {
/// final linkedList = LinkedList<EntryItem>();
/// linkedList.addAll(
/// [EntryItem(1, 'A'), EntryItem(2, 'B'), EntryItem(3, 'C')]);
/// linkedList
/// .addAll([EntryItem(1, 'A'), EntryItem(2, 'B'), EntryItem(3, 'C')]);
/// print(linkedList.first); // 1 : A
/// print(linkedList.last); // 3 : C
///