notificationNameToUnsubscribeMethod function

String notificationNameToUnsubscribeMethod(
  1. String notificationName
)

Transforms a notification name to its corresponding unsubscribe method name.

For example, 'accountNotifications' becomes 'accountUnsubscribe'.

Implementation

String notificationNameToUnsubscribeMethod(String notificationName) {
  return notificationName.replaceAll(RegExp(r'Notifications$'), 'Unsubscribe');
}