Packages Deal with name conflicts when importing packages

This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below.
Get Unlimited PRO Access

OR


*Enrollment provides full access to this course (and updates) for life.

Namespace packages

The easiest way to deal with name conflicts is to use a namespace package.

file_type_dartlang packages.dart
import 'somewhere.dart' as External;

Exclude code from a package

Exclude code from a package with the hide keyword.

file_type_dartlang packages.dart
import 'somewhere.dart' hide Circle;

Isolate code from a package

Import individual classes from a package with the show keyword.

file_type_dartlang packages.dart
import 'somewhere.dart' show Rectangle;

Q&A Chat