getValue function

String? getValue(
  1. String source,
  2. String key
)

Implementation

String? getValue(String source, String key) {
  key = '\n' + key;
  int index = source.indexOf(key);
  if (index < 0) {
    return null;
  } else {
    source = source.substring(index + 1 + key.length);
  }
  index = source.indexOf("\n");
  if (index == -1) return null;
  return source.substring(0, index).trim();
}