The following _TypeError was thrown building SplashScreen(dirty): Null check operator used on a null value
The relevant error-causing widget was:
SplashScreen SplashScreen:file:///D:/cek/chat_apps/lib/main.dart:45:43
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: Null check operator used on a null value
Another exception was thrown: 'package:flutter/src/material/theme_data.dart': Failed assertion: line 449 pos 12: 'colorScheme?.brightness == null|| brightness == null || colorScheme!.brightness == brightness': is not true.
Lost connection to device.
class MyApp extends StatelessWidget {
final authC = Get.put(AuthController(), permanent: true);
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: Future.delayed(Duration(seconds: 3)),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return Obx(
() => GetMaterialApp(
title: "ChatApp",
theme: ThemeData(
primaryColor: Colors.white, colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.black),
),
initialRoute: authC.isSkipIntro.isTrue
? authC.isAuth.isTrue
? Routes.HOME
: Routes.LOGIN
: Routes.INTRODUCTION,
getPages: AppPages.routes,
),
);
}
return FutureBuilder(
future: authC.firstInitialized(),
builder: (context, snapshot) => SplashScreen(),
);
},
I think it's related to this condition:
You need to check beforehand if colorScheme is not null or replace the ! operator with ?.