You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I learned that Flutter does not serve static files from the assets directory even though the flutter build command produces this directory with the output. Rather, assets defined in pubspec.yaml are packaged into an asset bundle. For this reason, changing the contents of the assets directory, post build, does nothing.
Interestingly, the dotenv.load() method retrieves the file via an http request (this is why we see the file in the browser inspection tool). At this time, it is possible to use the http server (Apache, caddy, etc) matching rules to serve the config files from their file locations rather than from the Flutter asset bundle. I would advice an automated test that ensures these files are produced by flutter build if your production configuration depends on it. There is no guarantee that flutter build produces these files in future revisions. By defining a url matching rule that serves the static config file(s), from the http server configuration, we can accomplish runtime config. Given this is in place, updating the config files, post build, will affect the running web app.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I learned that Flutter does not serve static files from the
assets
directory even though theflutter build
command produces this directory with the output. Rather, assets defined inpubspec.yaml
are packaged into an asset bundle. For this reason, changing the contents of theassets
directory, post build, does nothing.Interestingly, the
dotenv.load()
method retrieves the file via an http request (this is why we see the file in the browser inspection tool). At this time, it is possible to use the http server (Apache, caddy, etc) matching rules to serve the config files from their file locations rather than from the Flutter asset bundle. I would advice an automated test that ensures these files are produced byflutter build
if your production configuration depends on it. There is no guarantee thatflutter build
produces these files in future revisions. By defining a url matching rule that serves the static config file(s), from the http server configuration, we can accomplish runtime config. Given this is in place, updating the config files, post build, will affect the running web app.Beta Was this translation helpful? Give feedback.
All reactions