formatChecklist function

String formatChecklist(
  1. List<({bool checked, String text})> items
)

Format a list of items as a markdown checklist.

Implementation

String formatChecklist(List<({String text, bool checked})> items) {
  return items
      .map((item) => '- [${item.checked ? 'x' : ' '}] ${item.text}')
      .join('\n');
}