ensureTemplatesExist static method
Future<void>
ensureTemplatesExist(
)
Implementation
static Future<void> ensureTemplatesExist() async {
final templatesDir = Directory('lib/templates');
if (templatesDir.existsSync()) {
print('🗑️ Removing old templates...');
templatesDir.deleteSync(recursive: true);
}
print('📥 Downloading latest templates...');
final result = await Process.run(
'git',
[
'clone',
'https://github.com/Syed-Bipul-Rahman/bipul_templates.git',
'lib/templates'
],
runInShell: true,
);
if (result.exitCode != 0) {
throw Exception('Failed to download templates:\n${result.stderr}');
}
print('✅ Templates downloaded successfully!');
}