Reputation: 31
When I first run the application or restart it, this error appears in the console. I tried a few things but it didn't work. Any solution please?
This is main.dart
:
void main() {
WidgetsFlutterBinding.ensureInitialized();
OnePlatform.app = () => const MyApp();
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return Material(
child: MaterialApp(
title: ...,
builder: OneContext().builder,
navigatorKey: OneContext().key,
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: false,
),
home: const HomePage()
),
);
}
Upvotes: 0
Views: 65
Reputation: 678
Always check the error properly. You might get valuable info in the error to solve the issue. The solution was pointed out in the Error log.
Wrap your app with OneContext in main -
void main() {
runApp(OneContext().builder(child: MyApp()));
}
And from MaterialApp -
Remove builder: OneContext().builder
Upvotes: 0