Home > Software engineering >  What is the purpose of hiding EmailAuthProvider for firebase_auth?
What is the purpose of hiding EmailAuthProvider for firebase_auth?

Time:01-30

What is the purpose of the "hide" I see in almost all the example imports like the one below?

import 'package:firebase_auth/firebase_auth.dart'        
    hide EmailAuthProvider, PhoneAuthProvider;           // new

Even after multiple google searches and searches here, I can't find the answer. It is probably buried in some Dart tutorial somewhere, but I am really getting tired of searching through documentation that ends abruptly with a "404" or points to documentation that clearly labels itself as archived.

CodePudding user response:

The keyword hide is used to only partially import names from the referenced library. In your case, you import all names except for the ones EmailAuthProvider and PhoneAuthProvider.

This can be useful when you import two libraries that contain the same name. Then you can hide one to make it clear which one to use.

For context, take a look at the dart language tour.

  • Related