I saw this code, but found no explanation for what "..." means.
return ListView(
children: <Widget>[
if (bookCards != null) ...bookCards,
],
);
I saw this code, but found no explanation for what "..." means.
return ListView(
children: <Widget>[
if (bookCards != null) ...bookCards,
],
);
It is called Spread Operator. It was included in dart from Dart 2.3.
How to use it?
Consider the below as the basic example of how to use Spread Operator (...
) in dart.
var var1 = [0,1,2,3,4];
var var2 = [6,7,8,9];
var var3 = [...var1,5,...var2];
print(var3);
It prints [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]