simplify method

String simplify({
  1. bool trim = true,
  2. bool collapseSapces = true,
  3. bool lowerCase = true,
  4. String nullValue = '',
})

Implementation

String simplify(
    {bool trim = true,
    bool collapseSapces = true,
    bool lowerCase = true,
    String nullValue = ''}) {
  var self = this;
  if (self == null) return nullValue;

  if (collapseSapces) {
    self = self.replaceAll(RegExp(r'\s+'), ' ');
  }

  if (trim) {
    self = self.trim();
  }

  if (lowerCase) {
    self = self.toLowerCase();
  }

  return self;
}