getTemplateSize method

String getTemplateSize(
  1. String name
)

Get template size by name. Returns a string with the size in GB fixed to 2 decimal places. e.g. 1.23 GB

Implementation

String getTemplateSize(String name) {
  var path = getTemplateFilePath(name);
  if (File(path).existsSync() == false) return '0 GB';
  var size = File(path).lengthSync();
  return '${(size / 1024 / 1024 / 1024).toStringAsFixed(2)} GB';
}