Skip to content

Instantly share code, notes, and snippets.

@ebwood
Created August 31, 2021 18:45
Show Gist options
  • Save ebwood/4450f751ca54fbecce14036ef118698c to your computer and use it in GitHub Desktop.
Save ebwood/4450f751ca54fbecce14036ef118698c to your computer and use it in GitHub Desktop.
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