shuffled property

List<T> shuffled

Shuffles the elements of the list into a random order.

Example:

var numbers = [1, 2, 3, 4];
var shuffledNumbers = numbers.shuffled;
print(shuffledNumbers); // Output might be [2, 4, 1, 3]

Implementation

List<T> get shuffled {
  var newList = List<T>.from(this);
  newList.shuffle();
  return newList;
}