cleanRoute function

String cleanRoute(
  1. String route
)

Implementation

String cleanRoute(String route) {
  final result =
      route.replaceAll(RegExp(r'/+'), '/').replaceAll(RegExp(r'/$'), '');
  return result.isEmpty ? '/' : result;
}