randomOrNull method

E? randomOrNull([
  1. Random? random
])

Returns a random element from this collection using the specified source of randomness, or null if this collection is empty.

Implementation

E? randomOrNull([Random? random]) => isEmpty ? null : this.random(random);