Search code examples
flutterdartflutter-provider

Showing White Screen in Flutter Project


After running my project, a white screen appeared without any errors.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  SystemChrome.setPreferredOrientations(
      [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);

  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  static const appName = 'Marc Jr Foundation';
  //https://upcdatabase.org/
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      child: Provider<AuthBase>(
        create: (context) => Auth(),
        child: MaterialApp(
          debugShowCheckedModeBanner: false,
        ),
      ),
    );
  }
}


Solution

  • Inorder to use MultiProvider, you need to provide providers.

    class MyApp extends StatelessWidget {
      static const appName = 'Marc Jr Foundation';
      //https://upcdatabase.org/
      @override
      Widget build(BuildContext context) {
        return MultiProvider(
          providers: [
            Provider(
              create: (context) => AuthBase(),
            )
          ],
          child: MaterialApp(
            debugShowCheckedModeBanner: false,
            theme: ThemeData(