relativePath static method

String relativePath(
  1. String path
)

Implementation

static String relativePath(String path) {
  final regX = RegExp(r'.+/docs/');
  path = path.replaceFirst(regX, './docs/'); // *.......*
  if (path.startsWith('./docs/')) return path; // *.....*
  return './docs/${path.replaceFirst(RegExp(r'\A/'), '')}';
}