checkIfDirectoryExists method

Future<void> checkIfDirectoryExists({
  1. required String layer,
  2. required dynamic call(
    1. String path
    ),
})

Implementation

Future<void> checkIfDirectoryExists({
  required String layer,
  required Function(String path) call,
}) async {
  final dialog = CLI_Dialog(
    booleanQuestions: [
      [
        'Do you would like create $layer layer?',
        'create_directory',
      ],
    ],
  );

  final result = dialog.ask();

  if (!result['create_directory']) {
    return;
  }
  final path = (anwers['path'] as String).split('/');
  path.removeLast();
  await generateLayerController.generateLayerFolders(
    layerCommand: layer,
    path: path.first,
  );
  call(path.join('/'));
}