shuffle<T> static method

List<T> shuffle<T>(
  1. List<T> list
)

Shuffles a list and returns a new list

Example:

Helpers.shuffle([1, 2, 3]); // [3, 1, 2] (random order)

Implementation

static List<T> shuffle<T>(List<T> list) {
  final shuffled = List<T>.from(list);
  shuffled.shuffle();
  return shuffled;
}