In my HTML file I have:
<script>
var serverName = "dev.myapp.com:8080";
</script>
Then, in my Dart code:
import "dart:js" as js;
String SERVER_NAME = js.context["serverName"];
String SIGNIN_PLACE_URL = "http://$SERVER_NAME/signin";
String SIGNOUT_PLACE_URL = "http://$SERVER_NAME/signout";
class Place {
static const SigninPlace = const Place._(SIGNIN_PLACE_FRAGMENT_URL);
static const SignoutPlace = const Place._(SIGNOUT_PLACE_FRAGMENT_URL);
static get values => [SigninPlace, SignoutPlace];
final String fragmentURL;
const Place._(this.fragmentURL);
}
I'm getting an error inside my "enum" in regard to both my fragmentURL
arguments for both values:
Arguments of a constant creation must be constant expressions
So it looks like I need to make these fragmentURL
s const
, but not sure how. What's the solution here?