loremIpsumJP function

String loremIpsumJP({
  1. int paragraphs = 1,
  2. int words = 100,
  3. bool initWithLorem = false,
})

Implementation

String loremIpsumJP(
    {int paragraphs = 1, int words = 100, bool initWithLorem = false}) {
  if (paragraphs == null || paragraphs < 0) {
    throw new ArgumentError.value(paragraphs, "paragraphs");
  }
  if (words == null || words < 0) {
    throw new ArgumentError.value(words, "words");
  }

  if (paragraphs == 0 || words == 0) {
    return "";
  }

  if (paragraphs > words) {
    paragraphs = words;
  }

  String _lorem = _makeParagraphs(paragraphs, words);
  if (words > 3 && initWithLorem) {
    _lorem = _lorem.replaceAll(_lorem.split(" ")[0], "Lorem");
    _lorem = _lorem.replaceAll(_lorem.split(" ")[1], "ipsum,");
    return _lorem;
  }
  return _lorem;
}