LocationDescriptionDatabase.fromString constructor

LocationDescriptionDatabase.fromString(
  1. String data
)

Implementation

factory LocationDescriptionDatabase.fromString(String data) {
  final lines = data.replaceAll('\r\n', '\n').split('\n');
  final locations = <LocationDescription>[];
  for (final line in lines) {
    if (line.isEmpty || line[0].startsWith('#')) {
      continue;
    }
    locations.add(LocationDescription.fromString(line));
  }

  return LocationDescriptionDatabase(locations);
}