Flutter for Beginners
上QQ阅读APP看书,第一时间看更新

Importing show and hide

If you take a look at the preceding example, you will notice that we have not used all of the available classes from the person_lib library. To make the code cleaner and less susceptible to errors and naming conflicts, we can use the show keyword, which allows us to import only the identifiers that we want to use effectively in our code:

// import 'person_lib.dart' show Person, Student;

We can also specify the identifiers we explicitly don't want to import by using the hide keyword. In this case, we will be importing all of the identifiers from the library except the ones after the hide keyword:

// import 'person_lib.dart' hide Employee;