...) inserts multiple elements from a source expression into a target collection literal. It evaluates an expression yielding an Iterable or Map and expands its individual elements or key-value pairs into the surrounding context.
Syntax and Placement
The operator is placed immediately preceding an expression that evaluates to a collection. This expression is not limited to variable identifiers; it can be a function call, a direct collection literal, or any other logic that results in a compatible collection object.List and Set Expansion
When used within aList or Set literal, the operator iterates through the resulting Iterable of the expression and appends each element to the target collection.
Map Expansion
When used within aMap literal, the operator expands the resulting Map expression, inserting its key-value pairs into the target map.
Null-Aware Spread Operator (...?)
The null-aware spread operator (...?) handles scenarios where the source expression evaluates to null. If the expression is null, the operator bypasses the expansion and inserts nothing, preventing a runtime exception.
Type Constraints
The spread operator enforces static type safety. The element type of the source expression must be assignable to the element type of the destination collection.- Lists/Sets: If spreading into a
List<T>, the source expression must evaluate to anIterable<S>whereSis a subtype ofT. - Maps: If spreading into a
Map<K, V>, the source expression must evaluate to aMap<K2, V2>whereK2is a subtype ofKandV2is a subtype ofV.
Evaluation Order
Spread elements are evaluated in the order they appear in the literal (left-to-right). If a map spread contains keys that already exist in the target map, the later entries overwrite the earlier ones.Master Dart with Deep Grasping Methodology!Learn More





