How do I handle two packages that require MaterialApp as child in flutter?

137

I prefer using this way

return ScreenUtilInit(
  builder: () => MultiProvider(
    providers: [...],
    child: MaterialApp(
    //...
    ),
  ),
);
Share:
137
Marveltech
Author by

Marveltech

Updated on January 03, 2023

Comments

  • Marveltech
    Marveltech over 1 year

    I am using this screen util package that helps handle the responsiveness of the app on different screen size and I am also using provider both of them require MaterialApp as child but I don't know how to go about it instead I did this and now I'm having some issues navigating in the app.

      class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
    
      return MultiProvider(providers: [
      ChangeNotifierProvider(create: (_)=>
      TestimonyVeiwModel()
      ),
      ],
      child:  ScreenUtilInit(
      builder:() => MaterialApp(
      title: 'Stea app',
      theme: ThemeData();
    
  • Marveltech
    Marveltech over 2 years
    thanks let me try this out