Skip to content

Building a new collection out of an existing one is too imperative #46

Closed
@munificent

Description

@munificent

Dart has a nice declarative syntax for creating new lists and maps (and eventually probably sets) from a series of elements:

var list = [1, 2, 3];
var map {key: value};

This works well when building a collection out of individual elements. But if you want to insert the contents of an existing collection, you are forced to use an imperative, mutating API:

var args = testArgs.toList()
  ..add('--packages=${PackageMap.globalPackagesPath}')
  ..add('-rexpanded')
  ..addAll(filePaths);

Metadata

Metadata

Assignees

No one assigned

    Labels

    requestRequests to resolve a particular developer problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions