installStateManagement function

Future<void> installStateManagement(
  1. String projectPath,
  2. String state
)

Implementation

Future<void> installStateManagement(
  String projectPath,
  String state,
) async {
  final flutterCmd = Platform.isWindows ? 'flutter.bat' : 'flutter';

  if (state == 'bloc') {
    print('📦 Installing BLoC...');

    await Process.run(
      flutterCmd,
      ['pub', 'add', 'flutter_bloc', 'equatable'],
      workingDirectory: projectPath,
      runInShell: true,
    );
  } else if (state == 'riverpod') {
    print('📦 Installing Riverpod...');

    await Process.run(
      flutterCmd,
      ['pub', 'add', 'flutter_riverpod'],
      workingDirectory: projectPath,
      runInShell: true,
    );
  }
}