This is js code of doing it!
nums = [].concat(...digitBuckets);
how can i implement it in dart?
nums=[].addAll(...digitBucketsd);//facing problem here and confused
The spread operator is designed to insert array elements into another array or to map its elements to function arguments.
The mistake is that: elements of array are used as arguments of concat
function, but concat
function requires array as argument but not its elements as arguments:
replace
nums = [].concat(...digitBuckets);
nums = [].addAll(...digitBucketsd);
with
nums = [].concat(digitBuckets);
nums = [].addAll(digitBucketsd);
or with spread
nums = [...digitBuckets];
nums = [...digitBucketsd];
also digitBucketsd
is present in question instead of digitBuckets