toClientPathOrUri method

String? toClientPathOrUri(
  1. Uri? uri
)

Converts a URI into a form that can be used by the client.

If the client supports URIs (like VS Code), it will be returned unchanged but otherwise it will be the toFilePath() equivalent if a 'file://' URI and otherwise null.

Implementation

String? toClientPathOrUri(Uri? uri) {
  if (uri == null) {
    return null;
  } else if (clientSupportsUri) {
    return uri.toString();
  } else if (uri.isScheme('file')) {
    return uri.toFilePath();
  } else {
    return null;
  }
}