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)];
More Related Contents:
- How do you build a Singleton in Dart?
- The default ‘List’ constructor isn’t available when null safety is enabled. Try using a list literal, ‘List.filled’ or ‘List.generate’
- How can I compare Lists for equality in Dart?
- How to change status bar color in Flutter?
- Is there a way to load async data on InitState method?
- Global Variables in Dart
- Dart null safety doesn’t work with class fields [duplicate]
- How to add a component programmatically in Angular.Dart?
- What is the difference between ‘is’ and ‘==’ in Dart?
- Dartlang wait more than one future
- Persisting AppBar Drawer across all Pages Flutter
- Dart – Encode and decode base64 string
- What is the Dart null checking idiom or best practice?
- Replace initial Route in MaterialApp without animation?
- how can we use superscript and subscript text in flutter Text or RichText
- Flutter Load Image from Firebase Storage
- Flutter: Update Widgets On Resume?
- Logging large strings from Flutter
- Can the spread operator be used to supply function arguments?
- How to check if Flutter Text widget was overflowed
- Flutter Test MissingPluginException
- Flutter: How to get upload / download progress for http requests
- How do I compare two objects to see if they are the same instance, in Dart?
- Colon : in Dart constructor syntax
- Flutter – How to set status bar color when AppBar not present
- convert a String of “uint8list” to a Unit8List
- How can I simulate a tap event on a Flutter widget?
- How do you get the document id after adding document in Cloud Firestore in Dart
- how to add or remove item to the the existing array in firestore ?
- How to convert a List to List in null safe Dart?