color function Null safety

void color(
  1. String text,
  2. {Styles? front,
  3. Styles? back,
  4. bool isUnderline = false,
  5. bool isBold = false,
  6. bool isDark = false,
  7. bool isItalic = false,
  8. bool isReverse = false}
)

Implementation

void color(
  String text, {
  Styles? front,
  Styles? back,
  bool isUnderline: false,
  bool isBold: false,
  bool isDark: false,
  bool isItalic: false,
  bool isReverse: false,
}) {
  Colorize string = new Colorize(text);

  if (front != null) {
    string.apply(front);
  }

  if (back != null) {
    string.apply(back);
  }

  if (isUnderline) {
    string.apply(Styles.UNDERLINE);
  }

  if (isBold) {
    string.apply(Styles.BOLD);
  }

  if (isDark) {
    string.apply(Styles.DARK);
  }

  if (isItalic) {
    string.apply(Styles.ITALIC);
  }

  if (isReverse) {
    string.apply(Styles.REVERSE);
  }

  print(string);
}