renderBaseProject function

Map<String, List<int>> renderBaseProject(
  1. Map<String, String> bundled,
  2. BaseProjectConfig config
)

Decodes the bundled template (path -> base64 gzip) and applies config.

Implementation

Map<String, List<int>> renderBaseProject(
  Map<String, String> bundled,
  BaseProjectConfig config,
) {
  final out = <String, List<int>>{};
  bundled.forEach((path, encoded) {
    final bytes = gzip.decode(base64.decode(encoded));
    String? text;
    try {
      text = utf8.decode(bytes);
    } on FormatException {
      text = null; // binary: copy as-is
    }
    out[_renamePath(path, config)] =
        text == null ? bytes : utf8.encode(_renameText(text, config));
  });
  return out;
}