dart_random_choice 一个从迭代器生成随机选择的库。 例子 import 'dart:math' show Point; import 'package:dart_random_choice/dart_random_choice.dart' ; void main () { const List < String> foodOptions = [ 'burger' , 'pizza' , 'salad' ]; const List < double> weights = [ 10 , 20 , 0.4 ]; String whatToEat = randomCho