I am having Text which i am styling with Google fonts and is working okay but when i add const before Text i get Invalid Constant Value Error
Below is how i have implemented without const
Text(
'Voila',
style: GoogleFonts.dawningOfANewDay(fontSize: 30),
),
Below is how i have tried implementing with const
const Text(
'Voila',
style: GoogleFonts.dawningOfANewDay(fontSize: 30),
),
Below is how i have tried making google fonts constant but the error still persists
const Text(
'Voila',
style: const GoogleFonts.dawningOfANewDay(fontSize: 30),
)
You have to remove const from your code because constant values are expected to be hard coded but the font style or font family you are using is coming dynamically to const won't allow this.
Text(
'Voila',
style: const GoogleFonts.dawningOfANewDay(fontSize: 30),
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With