Home > front end >  Showing White Screen in Flutter Project
Showing White Screen in Flutter Project

Time:08-19

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,
        ),
      ),
    );
  }
}

CodePudding user response:

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(

CodePudding user response:

In terminal use;

  1. flutter clean
  2. flutter pub get
  • Related