createFlutterAppSync static method

void createFlutterAppSync({
  1. required String projectName,
})

Scaffolds a new Flutter app by running flutter create <projectName>.

Parameters:

  • projectName: the folder/name of the Flutter application to create.

Throws:

  • Exception when the flutter create command fails.

Implementation

static void createFlutterAppSync({required String projectName}) {
  try {
    print('📱 Creating Flutter app...');
    Process.runSync(
      'flutter',
      ['create', projectName],
      workingDirectory: Directory.current.path,
      runInShell: true,
    );
    print('✅ Flutter app created: $projectName');
  } catch (_) {
    throw Exception('Failed to create Flutter app');
  }
}