Closed bhawesh2002 closed 6 months ago
I'm facing the same problem. could you find a solution? @bhawesh2002
The exception is throwned becaues context
is not available to Get
package when Get.width
is encountered. Some of my other flutter apps face the same issue when Get
is used before the context
is completely available.
We use Themes.lightTheme
as ThemeData
for theme
property of GetMaterialApp
. This is when Get
is first used. Themes.lightTheme
has the toolbarHeight
property of the appBarTheme
which uses UiSizes.size_56
.
So when static double size_56 = 0.068 * Get.width + 0.034 * Get.height;
is encountered the context
is not fully available and
_TypeError (Null check operator used on a null value)
exception is throwned.
Another thing to note here is that if we just comment out the properties of theme
and darkTheme
of GetMaterialApp which after making changes should look like this:
GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'Resonate',
//theme: Themes.lightTheme,
//darkTheme: Themes.darkTheme,
themeMode: themeController.theme,
initialRoute: AppRoutes.splash,
getPages: AppPages.pages,
);
The _TypeError (Null check operator used on a null value)
is not throwned and everything works fine.
This implies that there is some issue faced by Get
package to obtain values of width,height etc. when Themes.lightTheme
is used as ThemeData
for the property theme
as any other codefiles using Get
package for width,height etc work completely fine.
@chandansgowda @Aarush-Acharya Is there any way we could deal with this.
Another thing to note here is that if we just comment out the properties of
theme
anddarkTheme
of GetMaterialApp which after making changes should look like this:GetMaterialApp( debugShowCheckedModeBanner: false, title: 'Resonate', //theme: Themes.lightTheme, //darkTheme: Themes.darkTheme, themeMode: themeController.theme, initialRoute: AppRoutes.splash, getPages: AppPages.pages, );
The
_TypeError (Null check operator used on a null value)
is not throwned and everything works fine.This implies that there is some issue faced by
Get
package to obtain values of width,height etc. whenThemes.lightTheme
is used asThemeData
for the propertytheme
as any other codefiles usingGet
package for width,height etc work completely fine.
π Describe the bug
The following exception was thrown when launching the app on device using API 34: _TypeError (Null check operator used on a null value)
Here is the screenshot: