Skip to content

redundant "Set.from" in the map docs #7317

@amit-dagan-remepy

Description

@amit-dagan-remepy

Page URL

https://dart.dev/libraries/dart-core

Page source

https://github.com/dart-lang/site-www/blob/main/src/content/libraries/dart-core.md

Describe the problem

in the doc


var hawaiianBeaches = {
'Oahu': ['Waikiki', 'Kailua', 'Waimanalo'],
'Big Island': ['Wailea Bay', 'Pololu Beach'],
'Kauai': ['Hanalei', 'Poipu'],
};

// Get all the keys as an unordered collection
// (an Iterable).
var keys = hawaiianBeaches.keys;

assert(keys.length == 3);
assert(Set.from(keys).contains('Oahu'));

no need to Set.from(keys)

Expected fix

var hawaiianBeaches = {
'Oahu': ['Waikiki', 'Kailua', 'Waimanalo'],
'Big Island': ['Wailea Bay', 'Pololu Beach'],
'Kauai': ['Hanalei', 'Poipu'],
};

// Get all the keys as an unordered collection
// (an Iterable).
var keys = hawaiianBeaches.keys;

assert(keys.length == 3);
assert(keys.contains('Oahu'));

Additional context

No response

I would like to fix this problem.

  • I will try and fix this problem on dart.dev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    from.page-issueReported in a reader-filed concern

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions