random property

T? random

Randomly gets an element from the list. Returns null if the list is empty.

Implementation

T? get random => isEmpty ? null : this[(Random().nextInt(length))];