createEventsTemplate function

String createEventsTemplate(
  1. String blocName, [
  2. String? newEventName
])

Creates the template string for the BLoC events.

Implementation

String createEventsTemplate(String blocName, [String? newEventName]) {
  if (newEventName != null) {
    return """}

class ${newEventName}Event extends ${blocName}Event {}
""";
  }
  return """
abstract class ${blocName}Event {}

class ${blocName}InitEvent extends ${blocName}Event {}
""";
}