Created
August 31, 2021 18:45
-
-
Save ebwood/4450f751ca54fbecce14036ef118698c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class HairColorNotifier extends ValueNotifier<int> { | |
HairColorNotifier(int value1) : super(value1); | |
} | |
class HairColorInheritedWidget extends InheritedNotifier<HairColorNotifier> { | |
HairColorInheritedWidget( | |
{Key? key, required Widget child, required HairColorNotifier notifier}) | |
: super(key: key, child: child, notifier: notifier); | |
static HairColorNotifier of(BuildContext context) { | |
return context | |
.dependOnInheritedWidgetOfExactType<HairColorInheritedWidget>()! | |
.notifier!; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment