convertToListInt method

List<int> convertToListInt()

Converts a string representation of a list of integers to a List

Implementation

List<int> convertToListInt() {
  // Remove the square brackets and whitespace
  String cleaned = replaceAll('[', '').replaceAll(']', '').trim();

  // Split by comma and convert each element to int
  return cleaned.split(',').map((e) => int.parse(e.trim())).toList();
}