VOOZH about

URL: https://www.geeksforgeeks.org/dart/dart-spread-operator/

⇱ Dart - Spread Operator (...) - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Dart - Spread Operator (...)

Last Updated : 31 Jan, 2022

In Dart, Spread Operator (...) and Null-aware Spread Operator (...?) are used for inserting multiple elements in a collection like Lists, Maps, etc.

Syntaxes:

  • Spread operator
...Data_structure
  • Null-aware Spread operator
...?Data_structure

Example 1: Using spread operators with List.

Output :

[Wow, Geeks, For, Geeks, is, amazing]

Example 2: Using Spread operator with Map.

Output :

{roll no: 45, class: 12, name: John, age: 21}

Example 3: Using spread operator with Sets.

Output:

{5,4,3,2,1}
Comment
Article Tags:
Article Tags:

Explore