💡 Did you know that Flutter Web allows you to know the app's version?

Let's see how 👇

📱When developing for mobile, we can easily check the app's version number by going to the settings or the app store

This can be quite useful whenever a user is reporting a bug 🐛

Or..

1/
Just to make sure our app got deployed to the stores correctly 🤦

However, Flutter Web doesn't seem to offer that out-of-the-box... or does it?

🔎 Let's explore the `build/web` folder after we build a flutter web app with

`$ flutter build web`

2/
We have:
🖼️ An icons folder and favicons
⚙️ JS and HTML files for the Flutter app
🕸️ manifest.json for PWA

And...

🤔 A version.json file:

`{"app_name":"version_json","version":"1.0.0","build_number":"1"}`

Whose version and build number coincide with pubspec.yaml: 1.0.0+1

3/
So, if our build folder has it, it means that we can access it!

Let's try it out 🚀

1⃣ `cd build/web` to go to the web build
2⃣ If you have python 3 installed, `python3 -m http.server 8080` will host it at localhost:8080
3⃣ Open your browser and navigate to localhost:8080

4/
If the app is running, we can access the `version.json`!

4⃣ Go to localhost:8080/version.json

It should open a blank web page where you see the contents of the version.json file!

This makes it WAY easier to determine if the deployment went through 🤩

5/
So, what other files do you show publicly in your `build/web` folder?

Maybe some easter eggs for your users? 🥚

If you liked the content, consider following me! @GonPalma

Also, be sure to check my blog 👇
gpalma.pt
And thanks to @ABarroso for suggesting the topic!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Gonçalo Palma

Gonçalo Palma Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @GonPalma

6 Oct
Using --dart-define, a 🧵

When we're developing Flutter apps we can have two issues:

1⃣ We want to add `flavors` for Flutter Web, but there's no out-of-the-box way of doing it

2⃣ Our app needs an API key or configuration that we don't want to commit

1/
In pure Dart, this can be easily achievable with the args package:

pub.dev/packages/args

We are able to stipulate what are the flags and arguments we need to use, such as:

`dart run bin/converter.dart --verbose --out-path="/out" data.json`

2/
This will:
1⃣ Run the converter.dart script
2⃣ With the flag verbose
3⃣ Setting an `out-path` of `/out`
4⃣ Accepting as a last argument the file `data.json`

However, the same cannot be applied to Flutter.

Why?

Because we have no direct control over

`flutter run`

3/
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(