Implementation
String getProgram(String? encoding) {
final out = StringBuffer();
out.writeln('# Program produced by JRPN ${model.modelName}.');
if (encoding != null) {
out.writeln('# Character encoding: $encoding');
}
final d = DateTime.now().toLocal();
final now = '${d.year}-${d.month}-${d.day} '
'${d.hour.toString().padLeft(2, '0')}:'
'${d.minute.toString().padLeft(2, '0')} ${d.timeZoneName}';
out.writeln('# Generated $now.');
out.writeln('');
for (final line in model.program.listing) {
out.writeln(line);
}
out.writeln('');
out.writeln('# End.');
return out.toString();
}