0

I am trying to access a static value which is stored in app.dart Class and static variables

I have set the value of this variable in splashscreen.dart Setting and printing the values

Here in Console

But shows error, that it requires static value only in login_register Error while accessing

Guide me, if I am doing something wrong.

Thank you

Pratik
  • 11
  • 4
  • The error message tells you what's wrong: default values to optional parameters must be constants. See https://stackoverflow.com/a/56489812/ for what you can do if you can't make it a constant. – jamesdlin Apr 24 '21 at 10:39
  • Yes, value needs to be constant and in each and every way, _Device.width_ passed is constant, best of my knowledge, then why it doesn't fetch that or is it a dynamic value passed, which its doesn't entertain? – Pratik Apr 24 '21 at 13:21
  • `Device.width` is a getter. Is it not a compile-time constant. Constants are declared with `const`. – jamesdlin Apr 24 '21 at 20:12
  • Yup solved the issue, Thanks – Pratik Apr 26 '21 at 08:27

0 Answers0