Skip to content

Commit 61be634

Browse files
committed
Fix flavor being ignored on linux (and maybe windows)
1 parent 6b775ea commit 61be634

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/app/utils/flavor.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ enum Flavor {
2323

2424
static Flavor _current =
2525
parse(appFlavor ?? '') ??
26-
parse(String.fromEnvironment('OUISYNC_FLAVOR')) ??
26+
// Note the `const` is crucial here. According to the [docs]
27+
// (https://api.flutter.dev/flutter/dart-core/String/String.fromEnvironment.html):
28+
//
29+
// > This constructor is only guaranteed to work when invoked as const. It may work as a
30+
// > non-constant invocation on some platforms which have access to compiler options at
31+
// > run-time, but most ahead-of-time compiled platforms will not have this information.
32+
parse(const String.fromEnvironment('OUISYNC_FLAVOR')) ??
2733
production;
2834

2935
static Flavor get current => _current;

0 commit comments

Comments
 (0)