resolvedImportUri method

String? resolvedImportUri(
  1. String path, {
  2. ImportStyle style = ImportStyle.granular,
  3. BarrelImportCache barrelCache = const BarrelImportCache.empty(),
})

Resolves the import URI used for grouping and writing import statements.

Implementation

String? resolvedImportUri(
  String path, {
  ImportStyle style = ImportStyle.granular,
  BarrelImportCache barrelCache = const BarrelImportCache.empty(),
}) {
  final import = this.import.resolved(path);
  if (import == null) {
    return null;
  }

  return switch (style) {
    ImportStyle.granular => import,
    ImportStyle.barrel =>
      barrelCache.resolve(import, associatedElement) ?? import,
  };
}