getDummyText static method

String getDummyText(
  1. int words, {
  2. bool withTab = false,
  3. bool withEmoji = false,
  4. dynamic withStop = true,
})

Implementation

static String getDummyText(int words, {bool withTab = false,bool withEmoji=false,withStop=true}) {
  var rand = new Random();
  List<String> dummyTexts = _dummyText.split(" ");

  if(withEmoji){
    dummyTexts.addAll(_emojiText.split(" "));
  }

  int size = dummyTexts.length;
  String text = "";
  if (withTab) text += "\t\t\t\t";
  String firstWord = dummyTexts[rand.nextInt(size)];
  firstWord = firstWord[0].toUpperCase() + firstWord.substring(1);
  text += firstWord + " ";

  for (int i = 1; i < words; i++) {
    text += dummyTexts[rand.nextInt(size)] + (i==words-1? "" : " ");
  }

  return text+ (withStop?".":"");
}