randomOrNull method

T? randomOrNull()

Implementation

T? randomOrNull() {
  if (this.isEmpty) return null;
  final randomIdx = _random.nextInt(this.length);
  return this.toList()[randomIdx];
}