createFeature static method

void createFeature({
  1. String? name,
  2. String? pageS,
})

Implementation

static void createFeature({String? name, String? pageS}) {
  String? featureName;
  if (name != null) {
    featureName = name;
  } else {
    stdout.write("${ColorsText.blue}Enter feature name: ${ColorsText.reset}");
    featureName = stdin.readLineSync();
  }
  updateFeaturesInConfigFile(featureName ?? '');

  CreatorUtil.createDirectory('$path/features');
  CreatorUtil.createDirectory('$path/features/$featureName');
  CreatorUtil.createDirectory('$path/features/$featureName/actions');
  CreatorUtil.createDirectory('$path/features/$featureName/bloc');
  CreatorUtil.createFileWithContent(
      '$path/features/$featureName/${featureName}_feature.dart',
      featureSample(featureName!));
  CreatorUtil.createFileWithContent(
      '$path/features/$featureName/${featureName}_page.dart',
      pageS ?? pageSample(featureName));
  CreatorUtil.createFileWithContent(
      '$path/features/$featureName/bloc/${featureName}_state.dart',
      stateSample(featureName));
  CreatorUtil.createFileWithContent(
      '$path/features/$featureName/bloc/${featureName}_bloc.dart',
      cubitSample(featureName));
}