Closed rgtstha closed 2 years ago
Please use the context that ScreenUtilInit's builder provide.
ScreenUtilInit(
...,
builder: (ctx) => MaterialApp(
...,
theme: AppTheme.theme(ctx),
...,
),
...,
),
And make sure you don't use any ScreenUtil.setContext() in the app since you use ScreenUtilInit() or else you must use ScreenUtil.setContext() on any other screen that uses the library, at least if it's not a descendent.
I am getting an exception when the screen changes using
BottomNavigationBar
.Here is the full error
Material App
Error screen
Error
I some how fixed the issue by setting
ScreenUtil.setContext(context);
in each screen. Is there any better approach ?