scaleAndSave method

void scaleAndSave(
  1. num s
)

Scale file and save it.

Implementation

void scaleAndSave(num s) {
  final r = <String>[];

  final raw = file.readAsStringSync();
  final lines = raw.split('\n');
  for (final line in lines) {
    r.add(line);

    if (line.isEmpty) {
      continue;
    }

    final sized = SizedElementFactory.createFromString(line);
    if (sized == null) {
      continue;
    }

    sized.scale(s);
    r.last = sized.toString();
  }

  final newRaw = r.join('\n');
  file.writeAsStringSync(newRaw, flush: true);
}