I get the following error in my Dart Analysis:
error: The body might complete normally, causing 'null' to be returned, but the return type is a potentially non-nullable type. (body_might_complete_normally at [the_book_club] lib\main.dart:28)
This is my lib/main.dart:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(App());
}
class App extends StatefulWidget {
@override
_AppState createState() => _AppState();
}
class _AppState extends State<App> {
final Future<FirebaseApp> _initialization = Firebase.initializeApp();
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: _initialization,
builder: (context, snapshot) {
if (snapshot.hasError) {
return SomethingWentWrong();
}
if (snapshot.connectionState == ConnectionState.done) {
return AnimatedSplashScreen(
duration: 3000,
splash: const FaIcon(
FontAwesomeIcons.bookOpen,
size: 200,
),
nextScreen: HomePage(),
splashTransition: SplashTransition.fadeTransition,
backgroundColor: const Color.fromARGB(255, 96, 125, 139),
);
}
},
);
}
}
class SomethingWentWrong extends StatelessWidget {
const SomethingWentWrong({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(
child: Row(
children: <Widget>[Text('something went wrong!')],
),
);
}
}