makeTheme static method

Future<void> makeTheme(
  1. String className,
  2. String value, {
  3. String folderPath = themesFolder,
  4. bool forceCreate = false,
})

Creates a new Theme.

Implementation

static Future<void> makeTheme(
  String className,
  String value, {
  String folderPath = themesFolder,
  bool forceCreate = false,
}) async {
  String name = className.replaceAll(RegExp(r'(_?theme)'), "");

  String filePath = '$folderPath/${name.snakeCase}_theme.dart';

  await _makeDirectory(folderPath);
  await _checkIfFileExists(filePath, shouldForceCreate: forceCreate);
  await _createNewFile(
    filePath,
    value,
    onSuccess: () {
      final linkText = '${name.snakeCase}_theme';
      final link = MetroConsole.hyperlink(linkText, filePath);
      MetroConsole.writeInGreen('[Theme] $link created 🎉');
    },
  );
}