createOptionsString static method

String createOptionsString({
  1. String? options,
  2. bool? multiLine,
  3. bool? caseInsensitive,
  4. bool? dotAll,
  5. bool? extended,
})

Implementation

static String createOptionsString(
    {String? options,
    bool? multiLine,
    bool? caseInsensitive,
    bool? dotAll,
    bool? extended}) {
  if (options != null && options.isNotEmpty) {
    return options;
  }
  var buffer = StringBuffer();
  if (caseInsensitive ?? false) {
    buffer.write('i');
  }
  if (multiLine ?? false) {
    buffer.write('m');
  }
  if (dotAll ?? false) {
    buffer.write('s');
  }
  if (extended ?? false) {
    buffer.write('x');
  }
  return '$buffer';
}