flutter_flavorizr icon indicating copy to clipboard operation
flutter_flavorizr copied to clipboard

Suggestion for generating main.dart files more seamlessly

Open dJani97 opened this issue 2 years ago • 0 comments

Hey!

When using Flavorizr in a project, I found myself changing all the "Flavorized" main.dart files to look like this:

// main_dev.dart

import 'my_app/main.dart' as runner;
import 'flavors.dart';

Future<void> main() async {
  F.appFlavor = Flavor.DEV;
  await runner.main();
}

This ensures that the code of the "main" main.dart can remain unchanged, and is not duplicated into N amount of different flavour files.

It might be just a personal preference, or it might really help a lot of you if files would be generated this way out of the box.

If this is not the way, how do you deal with code duplication in the main.dart files?

dJani97 avatar Aug 30 '22 06:08 dJani97