Files
sdk/pkg/analyzer/lib/dart/analysis/uri_converter.dart
T
Konstantin Shcheglov 9f986d2501 Migrate package:analyzer to null safety.
Change-Id: Iffe4370431587e46a141ddc72a86ceec29c163b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176486
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-02-01 18:56:04 +00:00

27 lines
1.2 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// A utility class used to convert between URIs and absolute file paths.
abstract class UriConverter {
/// Return the URI that should be used to reference the file at the absolute
/// [path], or `null` if there is no valid way to reference the file in this
/// converters context. The file at that path is not required to exist.
///
/// If a [containingPath] is provided and both the [path] and [containingPath]
/// are within the root of this converters context, then the returned URI
/// will be a relative path. Otherwise, the returned URI will be an absolute
/// URI.
///
/// Throws an `ArgumentError` if the [path] is `null` or is not a valid
/// absolute file path.
Uri? pathToUri(String path, {String? containingPath});
/// Return the absolute path of the file to which the absolute [uri] resolves,
/// or `null` if the [uri] cannot be resolved in this converters context.
///
/// Throws an `ArgumentError` if the [uri] is `null` or is not an absolute
/// URI.
String? uriToPath(Uri uri);
}