scaffoldAppException method

Future<void> scaffoldAppException(
  1. String projectPath
)

Implementation

Future<void> scaffoldAppException(String projectPath) async {
  final baseDir = projectPath.endsWith('/')
      ? projectPath.substring(0, projectPath.length - 1)
      : projectPath;

  final file = File('$baseDir/lib/core/exceptions/app_exception.dart');
  if (!await file.exists()) {
    await file.parent.create(recursive: true);
    await file.writeAsString('''
// Responsibility:
// Application level exception container.

sealed class AppException implements Exception {
final String message;

const AppException(this.message);
}

class UnknownException extends AppException {
const UnknownException(super.message);
}
''');
  }
}