Answers for "selecting a particular sublist in list in dart"

0

selecting a particular sublist in list in dart

var randomItem = (list.toList()..shuffle()).first;
Posted by: Guest on May-25-2020
0

selecting a particular sublist in list in dart

import "dart:math";

var list = ['a','b','c','d','e'];

// generates a new Random object
final _random = new Random();

// generate a random index based on the list length
// and use it to retrieve the element
var element = list[_random.nextInt(list.length)];
Posted by: Guest on May-25-2020

Code answers related to "selecting a particular sublist in list in dart"

Code answers related to "Dart"

Browse Popular Code Answers by Language