pack method
Packs the set of files located under resourceRoot Each resource has a registry entry and independently gzip-compressed 256 KiB parts in separate classes under generatedRoot.
A registry file will be generated in generated/resource_registry.g.dart which you can include to unpack the files onto the production system.
@Throwing(ArgumentError) @Throwing(CreateDirException) @Throwing(DeleteDirException) @Throwing(PathException) @Throwing(PathNotFoundException) @Throwing(ResourceException) @Throwing(SettingsYamlException) @Throwing(RangeError)
Implementation
void pack({bool includeHidden = false}) {
/// clear out an old generated files
/// as we use UUIDs if we didn't do this the
/// directory would keep growing.
if (exists(generatedRoot)) {
deleteDir(generatedRoot);
}
createDir(generatedRoot, recursive: true);
var resources = <String>[];
if (exists(resourceRoot)) {
resources = find(
'*',
workingDirectory: resourceRoot,
includeHidden: includeHidden,
).toList();
}
final packedResources = _packResources(resources);
_checkForDuplicates(packedResources);
print(' - generating registry');
_writeRegistry(packedResources);
print(green('Pack complete'));
}