readString method

Future<String> readString()

Implementation

Future<String> readString() async {
  final line = (await readLine()).trim();
  if (line.startsWith(RegExp('[\'"]'))) {
    final quote = line[0];
    return line
        .substring(1, line.indexOf(RegExp('(?<!$quote)$quote(?!$quote)'), 1))
        .replaceAll('$quote$quote', quote);
  }
  return (await readList()).first;
}