removeTrailingSlash function Null safety

String removeTrailingSlash(
  1. String serverUrl
)

Removes unncessary /

Implementation

String removeTrailingSlash(String serverUrl) {
  if (serverUrl.isNotEmpty &&
      serverUrl.substring(serverUrl.length - 1) == '/') {
    return serverUrl.substring(0, serverUrl.length - 1);
  } else {
    return serverUrl;
  }
}