skip to Main Content

By using a multilingual approach build is failing with a not fully clear error "Invalid constant value". As for the last screen, AppBar is taking a proper title where as body content is failing. Any thoughts? Thanks in advance!

enter image description here

enter image description here

2

Answers


  1. You need to remove "const" keyword on your Center widget as your localized text is not a const value.

    Login or Signup to reply.
  2. Since applocalizations provide values that could change over time within the app, it’s not a constant value. So, remove the const keyword before Center widget. Your updated code would look like so

     @override
      Widget build(BuildContext context) {
        return Center(
          child: Text(AppLocalizations.of(context)!.title),
        );
      }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search