randomPoint method

Vector2 randomPoint([
  1. Random? random
])

Generates a random point within the bounds of this Rect.

Implementation

Vector2 randomPoint([Random? random]) {
  final randomGenerator = random ?? randomFallback;
  return Vector2(
    left + randomGenerator.nextDouble() * width,
    top + randomGenerator.nextDouble() * height,
  );
}