xxxxxxxxxx
color: Colors.primaries[Random().nextInt(Colors.primaries.length)],
or
use package random_color 1.0.5
xxxxxxxxxx
// import 'dart:math' as math;
Color((math.Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0)
xxxxxxxxxx
import 'dart:math';
color:Colors.primaries[Random().nextInt(Colors.primaries.length)],
xxxxxxxxxx
import 'dart:math';
import 'package:flutter/material.dart';
Color getRandomColor() {
final random = Random();
return Color.fromRGBO(
random.nextInt(256),
random.nextInt(256),
random.nextInt(256),
1.0,
);
}
xxxxxxxxxx
Random random = Random();
Color tempcol = Color.fromRGBO(
random.nextInt(255),
random.nextInt(255),
random.nextInt(255),
1,
);
//tempcol is random color