-
-
Save AliAnilKocak/5e761d4f22ed356da3c4ef64504f9f9c to your computer and use it in GitHub Desktop.
runApp SharedPreferences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
SharedPreferences.getInstance().then((prefs) { | |
Color color = Color(0xFF56D4F9); //default renk | |
if (prefs.getInt('color') != null) { //sharedPreferences'ta kayıtlı ise | |
color = Color(prefs.getInt('color')); | |
} | |
runApp( | |
ChangeNotifierProvider<ThemeNotifier>( | |
create: (_) => ThemeNotifier(color), //kayıtlı olan rengi uygula | |
child: MyApp(), | |
), | |
); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment