toMessage method

String toMessage({
  1. String title = "",
  2. List<String> ignores = const [],
  3. int? pidProcces,
  4. String rewrite(
    1. String key,
    2. String? value,
    3. String defaultValue
    )?,
})

General Library Documentation Undocument By General Corporation & Global Corporation & General Developer

Implementation

String toMessage({
  String title = "",
  List<String> ignores = const [],
  int? pidProcces,
  String Function(String key, String? value, String defaultValue)? rewrite,
}) {
  String message = title;
  toJson(pidProcces: pidProcces).forEach((key, value) {
    value ??= "-";
    String defaultValue =
        "${key.split("_").map((e) => e.toUpperCaseFirstData()).join(" ")}: ${value}";
    if (rewrite != null) {
      message += rewrite.call(key, value, defaultValue);
    } else {
      if (ignores.contains(key)) {
        return;
      }
      message += "\n${defaultValue}";
    }
  });
  return message;
}