paragraphs method

dynamic paragraphs({
  1. int nParagraph = 3,
  2. int nSentence = 5,
  3. int nWords = 10,
  4. bool asText = false,
})
inherited

Generates fake List of paragraphs.

if asText is true return paragraphs as text. Example:

faker.paragraphs(nParagraphs: 2, nSentence:2)

Implementation

dynamic paragraphs(
    {int nParagraph = 3,
    int nSentence = 5,
    int nWords = 10,
    bool asText = false}) {
  if (nParagraph < 0) return "";

  List<String> paragraphs = <String>[
    for (int i = 0; i < nParagraph; i++)
      paragraph(nSentence: nSentence, nWords: nWords)
  ];

  if (asText) return paragraphs.join("\n");
  return paragraphs;
}