toList method

List<String?> toList({
  1. bool filterEmptyCharacter = false,
})

convert string to list.

Implementation

List<String?> toList({bool filterEmptyCharacter = false}) {
  final List<String> result = [];
  if (this != null) {
    final String newValue = this!;
    if (newValue.isEmpty) return result;
    for (var i = 0; i < newValue.length; i++) {
      final String character = newValue[i];
      if (filterEmptyCharacter && character.isNotEmpty) {
        result.add(character);
      } else {
        result.add(character);
      }
    }
  }
  return result;
}