generateNodeInfo function Null safety

List<NodeInfo> generateNodeInfo(
  1. BuildContext context,
  2. CanvasNestConfig nestConfig,
  3. ScreenSize screenSize
)

Implementation

List<NodeInfo> generateNodeInfo(
    BuildContext context, CanvasNestConfig nestConfig, ScreenSize screenSize) {
  final Random rng = Random();

  return List<NodeInfo>.generate(
      nestConfig.nodeCount,
      (index) => NodeInfo(
          rng.nextDouble() * screenSize.width,
          rng.nextDouble() * screenSize.height,
          rng.nextDouble() * 2 - 1,
          rng.nextDouble() * 2 - 1));
}