Lars Nyborg Pedersen
Lars Nyborg Pedersen

Reputation: 61

Flutter: Is flavor the best way to make multiple apps with the same codebase?

I'm going to make 10-50 different apps with the same codebase. So I'll probably have to use flavors. But is there a simpler way?

The only thing that's going to be different in the apps is the title, logo, maybe background, MP3 files and some text in the apps. Everything else will be the same.

What's the most straightforward way to do this? Can someone send some ressources I can learn from?

Upvotes: 3

Views: 1137

Answers (2)

Vahab Ghadiri
Vahab Ghadiri

Reputation: 2420

YES!

you can have :
Multiple configs so you can have some of this in flutter code base. [ apiBaseUrl , OnseSignalId , etc..

Flavors in both platform so you can have multiple apps ( applciation id in android and bundle id in ios ) and multiple folder for resources like Google-Service.json...

Upvotes: 0

ejabu
ejabu

Reputation: 3147

In my experience, I wrote multiple main.dart files. instead of having one lib/main.dart, we can have more e.g lib/main-us.dart, lib/main-uk.dart, lib/main-ge.dart.

in those files, we can put some parameters within MyApp using either Dependency Injection or Inherited Widget, therefore all children widgets can display correspondingly to its flavor

Upvotes: 1

Related Questions