ImportClass class final

🫘 Represents an import entry with optional qualification metadata.

ImportClass is a value object that encapsulates the name of a class or symbol being imported, along with a flag that indicates whether the import uses a fully qualified name.

Fields

  • name – The package name or qualified class name to be imported.
  • isQualifiedName – Whether name is a fully qualified identifier (e.g. package:my_app/src/service.MyService) instead of a simple class name.

Example

const simple = ImportClass.package('service');
const qualified = ImportClass.qualified('package:my_app/src/service.MyService');

print(simple.name);           // service
print(simple.isQualifiedName); // false
print(qualified.isQualifiedName); // true

Use Cases

  • Tracking import metadata in code generation.
  • Differentiating between short names and fully qualified names.
  • Used by import selectors or registries to manage dependency references.

Constructors

ImportClass(String name, bool isQualifiedName, [bool disable = false])
Creates a new ImportClass with the given name and isQualifiedName flag.
const
ImportClass.package(String name, [bool disable = false])
Creates a new ImportClass with the given name. This constructor is used when the import is not qualified.
const
ImportClass.qualified(String name, [bool disable = false])
Creates a new ImportClass with the given name. This constructor is used when the import is qualified.
const

Properties

disable β†’ bool
Whether this is a disable import
final
hashCode β†’ int
The hash code for this object.
no setterinherited
isQualifiedName β†’ bool
Whether name is fully qualified (e.g. includes a package or path).
final
name β†’ String
The name of the class or symbol to import.
final
runtimeType β†’ Type
A representation of the runtime type of the object.
no setterinherited

Methods

equalizedProperties() β†’ List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
noSuchMethod(Invocation invocation) β†’ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() β†’ String
A string representation of this object.
inherited

Operators

operator ==(Object other) β†’ bool
The equality operator.
inherited