Home > OS >  Is there any problem with using export keyword in real flutter apps
Is there any problem with using export keyword in real flutter apps

Time:09-27

I found myself splitting my work into a lot of other files, which causes a huge number of imports on main files, I know that the export keyword will help on this to avoid that, but when I search, I found that it's used mostly in libraries but not flutter apps,

my question is: is export keyword can be used on flutter apps normally like libraries or is there any kind of problems or reasons to avoid using it, and just deal with the normal import?

CodePudding user response:

Good practice is to use barrel files. So the idea is to create the file inside your folder and export all the widgets / files that you have in this folder (using export keyword). In result you will reduce the number of your imports and make project more readable. Flutter is so inteligent that using barrel files does not touch performance.

  • Related