generateNotices function
String
generateNotices(
- Map<
String, GatheredLicense> licenses, [ - NoticesFormat format = defaultNoticesFormat
Compile all licenses together into one notices string.
You can optionally override the NoticesFormat for the generated notices.
Implementation
String generateNotices(
Map<String, GatheredLicense> licenses, [
NoticesFormat format = defaultNoticesFormat,
]) {
String licensesTexts = '';
for (GatheredLicense license in licenses.values) {
if (licensesTexts != '') licensesTexts += format.licenseSeparator;
licensesTexts += format.license
.replaceAll('{{NAME}}', license.name)
.replaceAll('{{VERSION}}', license.version ?? format.nullVersion)
.replaceAll('{{LICENSE}}', license.license.text);
}
if (format.trim) {
return (format.header + licensesTexts + format.footer).trim();
}
return format.header + licensesTexts + format.footer;
}