loadString static method

Properties loadString(
  1. String text
)

Implementation

static Properties loadString(String text) {
  final properties = Properties();
  final lines = text.split('\n');
  for (var i = 0; i < lines.length; i++) {
    var line = lines[i];
    line = line.trim();
    if (line.startsWith('#')) {
      // The '#' is properties file comment.
      continue;
    }
    if (line.isEmpty) {
      // empty line
      continue;
    }
    try {
      final kv = line.split('=');
      final k = kv[0];
      final v = kv[1];
      properties[k] = v;
    } catch (e) {
      throw LoadPropertiesError(
          'The $i line have not to convert. The text is : $line');
    }
  }

  return properties;
}