Skip to content

Instantly share code, notes, and snippets.

@Vanethos
Last active April 12, 2019 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vanethos/fdc660ef47eb1c4e0aeda6eca2fc461d to your computer and use it in GitHub Desktop.
Save Vanethos/fdc660ef47eb1c4e0aeda6eca2fc461d to your computer and use it in GitHub Desktop.
class InjectorWidget extends InheritedWidget {
InjectorWidget({
Key key,
@required Widget child,
}) : assert(child != null),
super(key: key, child: child);
static InjectorWidget of(BuildContext context) {
return context.inheritFromWidgetOfExactType(InjectorWidget) as InjectorWidget;
}
@override
bool updateShouldNotify(InjectorWidget old) => false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment