I want to use


without context. I'm using this in my class model where there's no context. Here's my class:

class MenuItems {

 static const home = MenuItem('Home',Icons.home);
 static const frequentQuestion = MenuItem('Frequent Questions', Icons.question_answer);

 static const all = <MenuItem>[

Solution 1: Aizan Sagheer

I have solved this issue by declaring variable global like

BuildContext? kAppcontext

Then I initialized in main.dart under build now wherever I need it I used it as

 static const frequentQuestion = MenuItem(AppLocalizations.of(kAppcontext!)!.home,Icons.home);