Flutter app with a touch of Material You colors, please


Note: make sure to set targetSdk to 31 in app’s build.gradle file. Otherwise the new R.color.* attributes are not accessible.

future: getMaterialYouColor(),
builder: (context, AsyncSnapshot<MaterialYouPalette?> snapshot) {
final primarySwatch = snapshot.data?.accent1 ?? Colors.blue;
return MaterialApp(
theme: ThemeData(
primarySwatch: primarySwatch,



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store