I am Beginner to Flutter just following the YouTube tutorial on building User Profile while doing everything is OK but Theme Provider gave me the error I didn't understand What's going on can You guys help me, the error is The method 'of' isn't defined for the type 'ThemeProvider'
, I am getting error at
@override
Widget build(BuildContext context) {
final user = UserPreferences.getUser();
return ThemeProvider(
initTheme: user.isDarkMode ? MyThemes.darkTheme : MyThemes.lightTheme,
child: Builder(
builder: (context) => MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeProvider.of(context),
title: title,
home: const ProfilePage(),
),
),
);
}
and full code is so long so I Attaching github link for reference, Thanking You Advance.
After updating theme_provider in dependency I got 2 more errors below I attached a screenshot of it.