As far as I can tell there is no good reason for appFlavor being nullable, it shouldn't be used with a null value, right? So I'd suggest using a type Flavor instead of Flavor?. Also, probably this should be final, because why would the flavor change at runtime? Perhaps something like
enum Flavor {
a,
b,
}
class F {
static late final Flavor appFlavor;
static String get name => appFlavor.name;
static String get title {
switch (appFlavor) {
case Flavor.a:
return 'Alice';
case Flavor.b:
return 'Bob';
}
}
}
is more suitable? (Just a suggestion. Note that when failing to set the flavor - which is done first in the flavor main files - this might cause a LateInitializationError instead of silently working with a non-existent flavor name, for example.)
As far as I can tell there is no good reason for appFlavor being nullable, it shouldn't be used with a null value, right? So I'd suggest using a type
Flavor
instead ofFlavor?
. Also, probably this should be final, because why would the flavor change at runtime? Perhaps something likeis more suitable? (Just a suggestion. Note that when failing to set the flavor - which is done first in the flavor main files - this might cause a LateInitializationError instead of silently working with a non-existent flavor name, for example.)