Gonçalo Palma Profile picture
Lead Flutter Developer 👨‍💻 Writer ✍️ Google Developer Expert for Flutter and Dart 💙
13 Oct
💡 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/
Read 7 tweets
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