createParagraph function
Creates random paragraphs.
Paragraphs are comprised of a random number of sentences, or explicitly
numSentences
long. numParagraphs
specifies the number of paragraphs
to generate.
Implementation
String createParagraph({int numSentences = -1, int numParagraphs = 1}) {
List<String> sentences = [];
if (numParagraphs > 1) {
return createText(numSentences: numSentences, numParagraphs: numParagraphs);
}
if (numSentences < 0) {
numSentences = randomInt(3, 5);
}
for (var i = 0; i < numSentences; i++) {
sentences.add(createSentence());
}
return sentences.getRange(0, sentences.length).join(" ");
}