convertStringIntoStringList method

List<String> convertStringIntoStringList()

Implementation

List<String> convertStringIntoStringList() {
  List<String> stringList = [];

  //stringList.length <= 2 means the String is only "[]"
  //or empty or has 1 character (meaning definitely not a list of String which would have minimum 2 characters for an empty list [])
  //therefore return an empty list
  //Furthermore, because the String received from the database
  //is of format "[string1, string2, ...]"
  //therefore when converting it, omit the first and last characters
  //(eg. the "[" and "]" characters of the String)
  //furthermore, each date is separated by the folowing two characters ", "
  stringList = length <= 2 ? [] : substring(1, length - 1).split(', ');

  return stringList;
}